Python. from dateutil.relativedelta import * works in shell but not in a script -


when go run

from datetime import *; dateutil.relativedelta import * 

from python script error me seems indicate problem module itself.

traceback (most recent call last):   file "c:\users\tom\documents\datetime.py", line 1, in <module>     datetime import *   file "c:\users\tom\documents\datetime.py", line 2, in <module>     dateutil.relativedelta import *   file "c:\users\tom\appdata\local\programs\python\python35\lib\site-packages\python_dateutil-2.0-py3.5.egg\dateutil\relativedelta.py", line 11, in <module>     import calendar   file "c:\users\tom\appdata\local\programs\python\python35\lib\calendar.py", line 47, in <module>     class _localized_month:   file "c:\users\tom\appdata\local\programs\python\python35\lib\calendar.py", line 49, in _localized_month     _months = [datetime.date(2001, i+1, 1).strftime in range(12)]   file "c:\users\tom\appdata\local\programs\python\python35\lib\calendar.py", line 49, in <listcomp>     _months = [datetime.date(2001, i+1, 1).strftime in range(12)] attributeerror: module 'datetime' has no attribute 'date' 

this however, not happen when use exact same statement in python shell, if used in shell works perfectly.

i did find directly related relativedelta part of dateutil, as

from dateutil import * 

works fine.

i have tried reinstalling dateutil thats pretty it.

running python 3.5.1 dateutil 2.0 if matters.

edit: sorry i'm idiot, file called datetime.py caused problem.

i believe it's source file name. guessing when python interpreter tries find datetime module search local directory first , datetime module source file datetime global package. this post explains more

once rename file dd.py instead of "c:\users\tom\documents\datetime.py" should work out.


Comments

Popular posts from this blog

neo4j - finding mutual friends in a cypher statement starting with three or more persons -

php - How to remove letter in front of the word laravel -

minify - Minimizing css files -