Import module failure with an egg(sometimes)
Would appreciate some help with where to start trying to find out what's going on here. We're using eggs as the format for extensions to our app and I'm having the odd bit of strangeness on one machine. I have another with identical software setup which behaves as expected. Here is a snippet of our code: pkg_resources.working_set.add_entry(fullName) dist_generator = pkg_resources.find_distributions(fullName) for dist in dist_generator: try: extension_class = dist.load_entry_point("jokosher.extensions", "extension") extension = extension_class() print("...done.") except Exception, e : print("...failed.") print(str(e)) and usually it works. Now because can run with an experimental version of the gstreamer libraries we can run a script before we run our program which sets various ENV variables (including PYTHONPATH) to point us to the development libraries instead of the stock ones. If I run with the stock setup everything is OK. On one machine (and one machine only) if I run the setup script in order to pick up the experimental libraries then I get ImportError. This is a section of the output by running the program with 'python -vv'. First - with the stock libs (no pre-run script): importing extension... AddInstrumentType-0.1-py2.4.egg # zipimport: found 10 names in /home/john/.jokosher/extensions/AddInstrumentType-0.1-py2.4.egg # zipimport: zlib available # trying /home/john/code/jokosher/trunk/Jokosher/AddInstrumentType.so # trying /home/john/code/jokosher/trunk/Jokosher/AddInstrumentTypemodule.so # trying /home/john/code/jokosher/trunk/Jokosher/AddInstrumentType.py # trying /home/john/code/jokosher/trunk/Jokosher/AddInstrumentType.pyc # trying /usr/lib/python2.4/site-packages/gst-0.10/AddInstrumentType.so # trying /usr/lib/python2.4/site-packages/gst-0.10/AddInstrumentTypemodule.so # trying /usr/lib/python2.4/site-packages/gst-0.10/AddInstrumentType.py # trying /usr/lib/python2.4/site-packages/gst-0.10/AddInstrumentType.pyc # trying /home/john/code/jokosher/trunk/Jokosher/AddInstrumentType.so # trying /home/john/code/jokosher/trunk/Jokosher/AddInstrumentTypemodule.so # trying /home/john/code/jokosher/trunk/Jokosher/AddInstrumentType.py # trying /home/john/code/jokosher/trunk/Jokosher/AddInstrumentType.pyc # trying /usr/lib/python24.zip/AddInstrumentType.so ... ... ... # trying /home/john/code/jokosher/trunk/AddInstrumentType.so # trying /home/john/code/jokosher/trunk/AddInstrumentTypemodule.so # trying /home/john/code/jokosher/trunk/AddInstrumentType.py # trying /home/john/code/jokosher/trunk/AddInstrumentType.pyc # trying /home/john/.jokosher/extensions/AddInstrumentType-0.1-py2.4.egg/AddInstrumentType/__init __.pyc # trying /home/john/.jokosher/extensions/AddInstrumentType-0.1-py2.4.egg/AddInstrumentType/AddIns trumentType/__init__.pyc # trying /home/john/.jokosher/extensions/AddInstrumentType-0.1-py2.4.egg/AddInstrumentType/AddIns trumentType/__init__.pyo # trying /home/john/.jokosher/extensions/AddInstrumentType-0.1-py2.4.egg/AddInstrumentType/AddIns trumentType/__init__.py # trying /home/john/.jokosher/extensions/AddInstrumentType-0.1-py2.4.egg/AddInstrumentType/AddIns trumentType.pyc # trying /home/john/.jokosher/extensions/AddInstrumentType-0.1-py2.4.egg/AddInstrumentType/Jokosh er.so # trying /home/john/.jokosher/extensions/AddInstrumentType-0.1-py2.4.egg/AddInstrumentType/Jokosh ermodule.so # trying /home/john/.jokosher/extensions/AddInstrumentType-0.1-py2.4.egg/AddInstrumentType/Jokosh er.py # trying /home/john/.jokosher/extensions/AddInstrumentType-0.1-py2.4.egg/AddInstrumentType/Jokosh er.pyc # trying /home/john/.jokosher/extensions/AddInstrumentType-0.1-py2.4.egg/AddInstrumentType/gtk.so # trying /home/john/.jokosher/extensions/AddInstrumentType-0.1-py2.4.egg/AddInstrumentType/gtkmod ule.so # trying /home/john/.jokosher/extensions/AddInstrumentType-0.1-py2.4.egg/AddInstrumentType/gtk.py # trying /home/john/.jokosher/extensions/AddInstrumentType-0.1-py2.4.egg/AddInstrumentType/gtk.py c # trying /home/john/.jokosher/extensions/AddInstrumentType-0.1-py2.4.egg/AddInstrumentType/os.so # trying /home/john/.jokosher/extensions/AddInstrumentType-0.1-py2.4.egg/AddInstrumentType/osmodu le.so # trying /home/john/.jokosher/extensions/AddInstrumentType-0.1-py2.4.egg/AddInstrumentType/os.py # trying /home/john/.jokosher/extensions/AddInstrumentType-0.1-py2.4.egg/AddInstrumentType/os.pyc # trying /home/john/.jokosher/extensions/AddInstrumentType-0.1-py2.4.egg/AddInstrumentType/pkg_re sources.so # trying /home/john/.jokosher/extensions/AddInstrumentType-0.1-py2.4.egg/AddInstrumentType/pkg_re sourcesmodule.so # trying /home/john/.jokosher/extensions/AddInstrumentType-0.1-py2.4.egg/AddInstrumentType/pkg_re sources.py # trying /home/john/.jokosher/extensions/AddInstrumentType-0.1-py2.4.egg/AddInstrumentType/pkg_re sources.pyc import AddInstrumentType.AddInstrumentType # loaded from Zip /home/john/.jokosher/extensions/AddI nstrumentType-0.1-py2.4.egg/AddInstrumentType/AddInstrumentType.pyc import AddInstrumentType # loaded from Zip /home/john/.jokosher/extensions/AddInstrumentType-0.1- py2.4.egg/AddInstrumentType/__init__.pyc ...done. No problems there. But after running the env-altering script all we get out is: importing extension... AddInstrumentType-0.1-py2.4.egg # zipimport: found 10 names in /home/john/.jokosher/extensions/AddInstrumentType-0.1-py2.4.egg # zipimport: zlib available ...failed. No module named AddInstrumentType It doesn't even seem to begin to look for the module. As I said this only happens on one machine and I know that it used to work on that one too. If you could give us a clue on what to look for next then that would be appreciated. Thanks -- John Green
At 08:56 PM 10/27/2006 +0100, John Green wrote:
It doesn't even seem to begin to look for the module. As I said this only happens on one machine and I know that it used to work on that one too. If you could give us a clue on what to look for next then that would be appreciated.
I'd suggest investigating the environment variables to see which one(s) are breaking things. Also, double check your paths to make sure you don't have another AddInstrumentType directory floating around, since that might be confusing things. The other thing would be to compare environment variables and directory contents with the machine that works.
participants (2)
-
John Green -
Phillip J. Eby