-
-
Notifications
You must be signed in to change notification settings - Fork 409
Closed
Description
I installed pendulum on Python 3.2 install, and when I run it, here's what I get:
% python3
Python 3.2.3 (default, Feb 20 2013, 17:02:41)
[GCC 4.7.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import pendulum
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.2/dist-packages/pendulum/__init__.py", line 3, in <module>
from .pendulum import Pendulum
File "/usr/local/lib/python3.2/dist-packages/pendulum/pendulum.py", line 19, in <module>
from .tz import Timezone, UTC, FixedTimezone, local_timezone
File "/usr/local/lib/python3.2/dist-packages/pendulum/tz/__init__.py", line 3, in <module>
from .timezone import Timezone, FixedTimezone, UTC
File "/usr/local/lib/python3.2/dist-packages/pendulum/tz/timezone.py", line 6, in <module>
from .loader import Loader
File "/usr/local/lib/python3.2/dist-packages/pendulum/tz/loader.py", line 10, in <module>
from .. import _compat
File "/usr/local/lib/python3.2/dist-packages/pendulum/_compat.py", line 19, in <module>
FileNotFoundError = FileNotFoundError
NameError: name 'FileNotFoundError' is not defined
It looks like the FileNotFoundError
exception, along with the rework of the OS/IO exceptions has been introduced in Python 3.3.
cf
I do not understand why FileNotFoundError
could not defined in Python 3.2. cf PEP-3151
Instead of relying on major python versions to check for features, I'd suggest to check for the feature and fallback to the alternative. Such as:
try:
FileNotFoundError = FileNotFoundError
except NameError:
FileNotFoundError = IOError
The Python3.2.3 I'm using, is the one from Debian Wheezy (old-stable) and I installed pendulum v0.5.5 from Pypi. I tried with the suggested fix above, and it works.