Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with parsing of time data #253

Open
Gokujo opened this issue Jun 15, 2021 · 2 comments
Open

Problem with parsing of time data #253

Gokujo opened this issue Jun 15, 2021 · 2 comments

Comments

@Gokujo
Copy link

Gokujo commented Jun 15, 2021

I try to import cities with this command
D:\GIT\pmv2> python manage.py cities_light

and I get this error

Traceback (most recent call last):
  File "manage.py", line 21, in <module>
    main()
  File "manage.py", line 17, in main
    execute_from_command_line(sys.argv)
  File "D:\Python\envs\pmv2\lib\site-packages\django\core\management\__init__.py", line 401, in execute_from_command_line
    utility.execute()
  File "D:\Python\envs\pmv2\lib\site-packages\django\core\management\__init__.py", line 395, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "D:\Python\envs\pmv2\lib\site-packages\django\core\management\base.py", line 328, in run_from_argv
    self.execute(*args, **cmd_options)
  File "D:\Python\envs\pmv2\lib\site-packages\django\core\management\base.py", line 369, in execute
    output = self.handle(*args, **options)
  File "D:\Python\envs\pmv2\lib\site-packages\cities_light\management\commands\cities_light.py", line 177, in handle
    geonames = Geonames(url, force=force)
  File "D:\Python\envs\pmv2\lib\site-packages\cities_light\geonames.py", line 24, in __init__
    force=force
  File "D:\Python\envs\pmv2\lib\site-packages\cities_light\geonames.py", line 48, in download
    force=force
  File "D:\Python\envs\pmv2\lib\site-packages\cities_light\downloader.py", line 30, in download
    if not self.needs_downloading(source, destination, force):
  File "D:\Python\envs\pmv2\lib\site-packages\cities_light\downloader.py", line 66, in needs_downloading
    '%a, %d %b %Y %H:%M:%S %Z'  # taking time with second
  File "D:\Python\Python37\Lib\_strptime.py", line 571, in _strptime_time
    tt = _strptime(data_string, format)[0]
  File "D:\Python\Python37\Lib\_strptime.py", line 359, in _strptime
    (data_string, format))
ValueError: time data 'Tue, 15 Jun 2021 00:53:43 GMT' does not match format '%a, %d %b %Y %H:%M:%S %Z'

I am using Django 3.0 and Python 3.7

@fulepo
Copy link

fulepo commented Sep 30, 2021

Hi, I am having the same issue with Python 3.9 and Django 3.1

@andrescollares
Copy link

I managed to run it successfully by setting the locale to "en_US".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants