[Tutor] Py2exe Problem

jfouhy@paradise.net.nz jfouhy at paradise.net.nz
Fri Jun 3 00:06:18 CEST 2005

Quoting Alberto Troiano <albertito_g at hotmail.com>:

> I'm having a problem with Py2exe.
> I created the executable but when I try to execute it it gives the
> following 
> error:
> Traceback (most recent call last):
>  File "NovusExtension.pyw", line 8, in ?
>  File "Pmw\__init__.pyc", line 28, in ?
> WindowsError: [Errno 3] El sistema no puede hallar la ruta especificada:
> 'C:\\Documents and 
> Settings\\percy.IMPOR-FERNANDO\\Escritorio\\NovExt\\dist\\library.zip\
> \Pmw/*.*'

It might help if you translated that error message :-)

But, I will make one guess, since I see the problem is to do with Pmw: 

>From this page: http://pmw.sourceforge.net/doc/dynamicloader.html

 When Pmw is first imported, an instance of PmwLoader is created and placed into
sys.modules['Pmw']. From that point on, any reference to attributes of the Pmw
'module' is handled by the loader. The real Pmw package is stored in


 Freezing Pmw

Since the dynamic loader requires that Pmw be installed at run time, it can not
be used when freezing Pmw. In this case, a single module containing all Pmw code
is required, which can then be frozen with the rest of the application's
modules. The bundlepmw.py script in the Pmw bin directory can be used to create
such a file. This script concatenates (almost) all Pmw megawidget files into a
single file, Pmw.py, which it writes to the current directory. The script is
called like this:

 bundlepmw.py [-noblt] [-nocolor] /path/to/Pmw/Pmw_X_X_X/lib

The last argument should be the path to the lib directory of the required
version of Pmw. By default, the Pmw.py file imports the PmwBlt and PmwColor
modules and so, to freeze an application using Pmw, you will need to copy the
files PmwBlt.py and PmwColor.py to the application directory before freezing.

If you are sure that your application does not use any of the Pmw.Blt or
Pmw.Color functions, you can use the -noblt or -nocolor options. In this case
Pmw.py will be modified so that it does not import these module(s) and so will
not need to be included when freezing the application.

If your application only uses a few Pmw megawidgets, you can remove the
references to the usused ones in the files list in the bundlepmw.py code. To
make the change, take a copy of the script and modify it. This will make the
Pmw.py file smaller. However, be sure that you do not delete megawidgets that
are components or base classes of megawidgets that you use.

If you haven't done this, you will need to, otherwise Pmw won't work with py2exe.


More information about the Tutor mailing list