[python-win32] Re: py2exe runtime problem...

Thomas Heller theller at python.net
Tue May 20 09:09:37 EDT 2003


Eric Walstad <eric at ericwalstad.com> writes:

> I didn't see any py2exe list, and I saw other posts on the subject in
> the archives, so I'm posting my question here.
> 
> 
> I have a little app consisting of 3 py files that I'm trying use with
> py2exe.  I get a couple of "compile-time" warnings from py2exe (see
> below) but no errors.  When I run the reuslting exe file I get a
> "IOError: invalid mode:" run-time error (see traceback below).
> 
> 
> If anyone can point me toward possible culptits, I'd sure appreciate it.
> 
> Thanks VERY much for your time!
> 
> Eric.
> 
> ##################  BEGIN TRACEBACK  ##################
> 
> C:\Documents and Settings\ewalstad\My Documents\ew\2003\pl\kiosk\plJoin\di
> st\Aggregator>aggregator.exe
> Traceback (most recent call last):
>    File "<string>", line 8, in ?
>    File "imputil.pyc", line 103, in _import_hook
>    File "<string>", line 52, in _import_top_module
>    File "imputil.pyc", line 216, in import_top
>    File "imputil.pyc", line 271, in _import_one
>    File "<string>", line 128, in _process_result
>    File "Serializer.pyc", line 2, in ?
>    File "imputil.pyc", line 103, in _import_hook
>    File "<string>", line 52, in _import_top_module
>    File "imputil.pyc", line 216, in import_top
>    File "imputil.pyc", line 267, in _import_one
>    File "<string>", line 161, in get_code
> IOError: invalid mode:

The "<string>" above refers to the code in
lib/site-packages/py2exe/support.py. Around line 161, there is this:

        info = _extensions_mapping.get(fqname)
        if info:
            pathname, desc = info
            # prepend exe_dir to filename
            pathname = "%s\\%s" % (sys.prefix, pathname)
            # Should catch IOError and convert into ImportError ??
(161)       fp = open(pathname, desc[1])
            dict['__file__'] = pathname
            return 0, imp.load_module(fqname, fp, pathname, desc), dict

Can you insert some print statements before this line to see what's
going wrong? I'm concerned about the comment before this line.

Thomas




More information about the Python-win32 mailing list