-
Notifications
You must be signed in to change notification settings - Fork 19
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
Recursive load fails in Python 3.4 from macports #11
Comments
This defect is also on Ubuntu / Debian and Python3.4. On Ubuntu 14.04 LTS here's how I reproduced this:
Note: This defect also shows up if you clone the github repo directly and use With the library installed, when you try to import it via
These all fail with the same import error:
Now viewing /home/gholly/py-envs/venv/lib/python3.4/site-packages/dynect/init.py here's the problem. /home/gholly/py-envs/venv/lib/python3.4/site-packages/dynect/init.py
Python will try to search for DynectDNS, and does not find it in any of the directories of sys.path. However, it looks like the module intended to be loaded here /home/gholly/py-envs/venv/lib/python3.4/site-packages/dynect/DynectDNS.py is located in the same directory. If you change init.py to instead use relative loading, it properly loads the DynectDNS module in both Python 2.7 and 3.4.
The difference is very subtle, but the import statement includes a dot, telling init.py to load from the current directory rather than searching for a module in the directories in sys.path, where it is currently not found. |
The init.py contains the following line, which seems to be redundant with the any import that would invoke it:
from DynectDNS import DynectRest
The default Python 2.7 installation in Mac OS 10.10 handles this just fine, but Python 3.4 fails to import it with this error:
$ ./example.py
Traceback (most recent call last):
File "./example.py", line 3, in
from dynect.DynectDNS import DynectRest
File "/Users/csnook/Envs/dynctl/lib/python3.4/site-packages/dynect/init.py", line 5, in
from DynectDNS import DynectRest
ImportError: No module named 'DynectDNS'
example.py contains only the following:
!/usr/bin/env python
from dynect.DynectDNS import DynectRest
When I comment out the import in init.py, Python 3.4 handles it just fine, but I have no idea if that would break other configurations, since I assume that statement was probably put there for a reason.
The text was updated successfully, but these errors were encountered: