Strange pytz import issue — pytz.UnknownTimeZoneEr

2019-09-04 23:26发布

I am having trouble importing a valid timezone on a pytz install.

When I run this:

python -c "import pytz; print pytz.timezone('America/New_York')"

In my home folder I have this output:

$ python -c "import pytz; print pytz.timezone('America/New_York')"
America/New_York

But if I cd into a different folder off of my home directory, I get this output:

$ cd webapp/
$ python -c "import pytz; print pytz.timezone('America/New_York')"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "pytz/__init__.py", line 173, in timezone
    raise UnknownTimeZoneError(zone)
pytz.UnknownTimeZoneError: 'America/New_York'

It seems to be loading pytz incorrectly..? Is there a way I can figure out why it's loading it differently, and how I can restore default behavior? Thanks!

0条回答
登录 后发表回答