coderholic / django-cities

Countries and cities of the world for Django projects
MIT License
921 stars 375 forks source link

'module' object has no attribute 'day_abbr' importing cities into postgres #116

Closed spac3-monk3y closed 7 years ago

spac3-monk3y commented 8 years ago

I'm trying to import all cities into database but I keep getting the same error. I'm using Ubuntu 14.04, Python 2.7.6 and Postgres 9.3. I have installed and enabled all GeoDjango for postgres.

Command: python manage.py cities --import=all

Error:

web_file_time = time.strptime(web_file.headers['last-modified'], '%a, %d %b %Y %H:%M:%S %Z')
  File "/usr/lib/python2.7/_strptime.py", line 270, in <module>
    _TimeRE_cache = TimeRE()
  File "/usr/lib/python2.7/_strptime.py", line 188, in __init__
    self.locale_time = LocaleTime()
  File "/usr/lib/python2.7/_strptime.py", line 71, in __init__
    self.__calc_weekday()
  File "/usr/lib/python2.7/_strptime.py", line 91, in __calc_weekday
    a_weekday = [calendar.day_abbr[i].lower() for i in range(7)]
AttributeError: 'module' object has no attribute 'day_abbr'
blag commented 8 years ago

Can you try to import each data type separately until you get the issue again?

So try:

python manage.py cities --import=country
python manage.py cities --import=region
python manage.py cities --import=subregion
python manage.py cities --import=city
python manage.py cities --import=district
python manage.py cities --import=alt_name
python manage.py cities --import=postal_code

and tell us which one/s error out.

blag commented 8 years ago

From this Django bug:

I found the original source of the problem - I had Google's gdata API installed, which includes a "calendar".

Do you have the Python Google client (gdata) installed?

blag commented 7 years ago

I have just released version 0.5 of django-cities to PyPI, which fixes a whole bunch of issues. Please try out that version and report back if you continue to have this issue.

I'm fairly certain that this issue is caused by the gdata module, so I'm closing this issue. If you troubleshoot it back to django-cities, please feel free to reopen this issue. Cheers!