We produce 2 Python applications that are distributed as egg files. We've produced them under Python 2.5.4 for years, but are now in the process of bringing them both up to 2.7.13. In this process, 1 of the 2 applications is now exhibiting weird behavior after install on 2.7.13.
When I easy_install.exe the egg, it appears to be successful in every way that I know how to look. However, when I try to import the module at the Python command line, I get an ImportError.
There are many strange things about this problem:
- This only happens on Windows -- both apps install and run fine on Linux
- This only happens with 1 of our 2 programs -- the other one runs fine everywhere
- easy_install does not complain at all during the problematic install on Windows
- the egg does appear in the path when I do "import sys / print sys.path"
- the egg does appear in the pth package list in site_packages
- I'm doing the entire install and testing as the Windows Administrator, so I don't think there could possibly be permissions problems
- We've made no changes to the source or the setup.py of either program when going from 2.5 to 2.7
- There's nothing fancy about the install -- no virtual env, just a global install into site_packages
Here's the setup.py of the failing egg (with module name changed to foo to protect the innocent):
from setuptools import setup
setup(name='foo',
description='Foo Module',
packages=['foo'],
entry_points = {
'console_scripts': [
'foo = foo.foo:main',
],
},
)
And here is the setup.py of the working egg:
from setuptools import setup
setup(name='bar',
description='Bar Tool',
packages=['bar', 'bar.hexes', 'bar.barlib'],
entry_points = {
'console_scripts': [
'bar = bar.main:main',
],
},
)
Since I don't see any problems up until the moment I try to import the module, how can I debug this issue?
My leading suspect at the moment is the foo.foo reference in the console_scripts section of the setup.py. It sounds somewhat similar to the answer given by @joest in this problem.