py2exe and tricky imports

Chris Prinos cprinos at foliage.com
Wed May 15 20:05:43 EDT 2002


I have a set of python applications running under the ActiveState Python 2.1
distribution in a win32 environment and am trying to use py2exe to create a
standalone executable.

For the simple cases, I can get it to work, but I am running into problems
with certain dependant modules not being found. In particular, it fails to
find varius modules from the xml package (PyXML is installed), mxDateTime
and mxODBC. I've seen some previous posts that say this is due to the way
these packages manipulate the default import mechanisms, but none of the
comments or suggested solutions seemed to help.

In the mxODBC doc, for example, it says:

"When freezing mxODBC you may experience problems with py2exe related to
py2exe not finding the DLLs needed by mxODBC. In this case you have to help
py2exe to find the correct subpackage for Windows. This can be done by
adding -i mx.ODBC.Windows,mx.DateTime to the py2exe command line: python
py2exe -i mx.ODBC.Windows,mx.DateTime yourapp.py. After doing so, py2exe
should have no problem finding the files mxODBC.pyd and mxDateTime.pyd
needed by mx.ODBC.Windows and mx.DateTime"

I tried doing this, along with other variations such as  "python setup.py
py2exe -p _xmlplus,mx"  to bring in the entire packages, as well as
experimenting with --force-imports, but have not had too much luck.

If anyone has run into this and found a solution, I'd love to hear about it.

Chris



An example of the (final) warnings from py2exe log are below:

warning: py2exe:
*************************************************************************
warning: py2exe: * The following modules were not found:
warning: py2exe: *   xml.dom.HierarchyRequestErr
warning: py2exe: *   win32com.client.NeedUnicodeConversions
warning: py2exe: *   mxDateTime.__version__
warning: py2exe: *   mx.DateTime.Timestamp
warning: py2exe: *   xml.dom.Node
warning: py2exe: *   mx.DateTime.DateFromTicks
warning: py2exe: *   win32com.client.Dispatch
warning: py2exe: *   mx.DateTime.Date
warning: py2exe: *   mx.DateTime.Time
warning: py2exe: *   mx.DateTime.TimestampFromTicks
warning: py2exe: *   mxTools.__version__
warning: py2exe: *   mx.DateTime.tz_offset
warning: py2exe: *   mx.DateTime.TimeFromTicks
warning: py2exe:
*************************************************************************





More information about the Python-list mailing list