Buenos Aires incorrect timezone

Bug #1402103 reported by furas / Bartłomiej Burek on 2014-12-12
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
astral
Medium
Simon Kennedy

Bug Description

I try this code

--- cut --
from astral import Astral

a = Astral()
c = a['Buenos Aires']

print c # get empty timezone

'''
Buenos Aires/Argentina, tz=, lat=-36.50, lon=-60.00
'''

s = c.sun()

print s # get error

'''
Traceback (most recent call last):
  File "example-buenos-aires.py", line 16, in <module>
    s = c.sun()
  File "astral.py", line 730, in sun
    sun[key] = dt.astimezone(self.tz)
  File "astral.py", line 670, in fget
    raise AstralError('Unknown timezone \'%s\'' % self.timezone)
astral.AstralError: Unknown timezone ''
'''
--- cut --

Solution:

There is incorrect timezone for Buenos Aires in _LOCATION_INFO - "Argentina/Buenos_Aires"
It should be "America/Argentina/Buenos_Aires"

I found correct timezone using pytz

--- cut ---
import pytz

pytz.all_timezones
--- cut ---

Simon Kennedy (sffjunkie) wrote :

pytz includes 2 names for Buenos Aires' time zone America/Buenos_Aires or America/Argentina/Buenos_Aires. America/Buenos_Aires used as code currently assumes that a timezone only has 1 '/' in it.

Changed in astral:
status: New → Fix Committed
importance: Undecided → Medium
assignee: nobody → Simon Kennedy (sffjunkie)
Changed in astral:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers