David Bolen
2005-08-02 19:39:29 UTC
I've been experimenting with converting our reasonably large system
over from Installer (which we've been using for a long time) to
py2exe, but I've been running into a strange problem with py2exe
failing to identify and include a particular module which seems to be
trivial to locate to me (and which Installer doesn't have a problem
with). The problem may be more an issue with the underlying
modulefinder module (since if I try to use that directly I get a
similar issue), but I'm not sure where else to inquire.
The problem showed up in a large scale system, but I've managed to
create a small example - it's a somewhat pointless hierarchy, but
realize that it's just my simplest form of what is actually a useful
hierarchy in my actual code.
If I have the following package structure:
a/__init__.py
resource.py
/c/__init__.py
resource.py
All of the package files are empty placeholders with the exception of
a/__init__.py which contains:
from resource import *
from a.c import resource
and a top level script (main.py) that contains:
import a
if __name__ == "__main__":
print 'hello'
and its matching setup.py:
from distutils.core import setup
import py2exe
setup(console=['main.py'])
Then running "python setup.py py2exe" processes the script and creates
the appropriate output in the "dist" directory, but fails to include
the a.c.resource module, although the rest of the a and c packages are
included. It does spit out at the end of processing:
The following modules appear to be missing
['a.c.resource']
so clearly it recognizes it's missing, but I can't figure out why it
can't find it.
In case it means anything, if I were to place an "import resource"
statement in the a/c/__init__.py module, then the above error message
changes to just 'resource' rather than 'a.c.resource', but in neither
case is the sub-package resource file included.
Can anyone offer any suggestions? This originally came about in our
application that has our own package which has an internal
"resource.py" module, but which also includes the twisted.web.resource
module (which I've replaced with the a.c module in the example here).
There are lots of sibling imports both in our packages and in twisted
(for example) none of which seem to cause a problem, except when one
is referenced in two ways in a single module as in this example.
Is there any way to get more verbose output from py2exe during the
scanning that is done and/or decisions made during the scanning
process?
Thanks for any suggestions.
-- David
over from Installer (which we've been using for a long time) to
py2exe, but I've been running into a strange problem with py2exe
failing to identify and include a particular module which seems to be
trivial to locate to me (and which Installer doesn't have a problem
with). The problem may be more an issue with the underlying
modulefinder module (since if I try to use that directly I get a
similar issue), but I'm not sure where else to inquire.
The problem showed up in a large scale system, but I've managed to
create a small example - it's a somewhat pointless hierarchy, but
realize that it's just my simplest form of what is actually a useful
hierarchy in my actual code.
If I have the following package structure:
a/__init__.py
resource.py
/c/__init__.py
resource.py
All of the package files are empty placeholders with the exception of
a/__init__.py which contains:
from resource import *
from a.c import resource
and a top level script (main.py) that contains:
import a
if __name__ == "__main__":
print 'hello'
and its matching setup.py:
from distutils.core import setup
import py2exe
setup(console=['main.py'])
Then running "python setup.py py2exe" processes the script and creates
the appropriate output in the "dist" directory, but fails to include
the a.c.resource module, although the rest of the a and c packages are
included. It does spit out at the end of processing:
The following modules appear to be missing
['a.c.resource']
so clearly it recognizes it's missing, but I can't figure out why it
can't find it.
In case it means anything, if I were to place an "import resource"
statement in the a/c/__init__.py module, then the above error message
changes to just 'resource' rather than 'a.c.resource', but in neither
case is the sub-package resource file included.
Can anyone offer any suggestions? This originally came about in our
application that has our own package which has an internal
"resource.py" module, but which also includes the twisted.web.resource
module (which I've replaced with the a.c module in the example here).
There are lots of sibling imports both in our packages and in twisted
(for example) none of which seem to cause a problem, except when one
is referenced in two ways in a single module as in this example.
Is there any way to get more verbose output from py2exe during the
scanning that is done and/or decisions made during the scanning
process?
Thanks for any suggestions.
-- David