"Bad file descriptor" after py2exe or Installer
Thomas Heller
theller at python.net
Mon Dec 29 17:20:52 EST 2003
[posted and mailed]
Luc Saffre <luc.saffre at gmx.net> writes:
> On 12.12.2003 15:41, Thomas Heller wrote:
>
>> py2exe seems to pick up cygwin binaries. The reason could be that
>> either you have cygwin extensions somewhere in your pythonpath, or parts
>> of the PATH env variable points into the cygwin directories, or
>> something like that. You should look at the output above carefully, and
>> make sure that it is what one would expect.
>
> That's it! Thank you, Thomas, your hint helped.
>
> I had the Cygwin tcltk package installed. After removing this package
> (using cygwin's setup.exe), I can use again the original PIL/Image.py
> and everything works fine.
>
> My PATH contains the cygwin bin directories:
> PATH=u:\CYGWIN\BIN;
> c:\python23\Scripts;c:\python23;
> ...
> u:\CYGWIN\USR\BIN;u:\CYGWIN\USR\LOCAL\BIN;...
>
> Another workaround is to remove the cygwin directories from PATH:
> I reinstalled the cygwin tcltk and the problem reappeared,
> moving the first cygwin directory to come after the python directory
> did not help. Then I removed those directories completely from PATH
> (during the build) and the problem disappeared again.
>
> I would consider this as a bug (in both py2exe and Installer) since
> they decide to pick some cygwin tcl/tk dll's who happen to hang around
> while the Python runtime won't...
This is part of the code (in build_exe.py).
def find_dependend_dlls(self, use_runw, dlls, pypath, dll_excludes):
import py2exe_util
sysdir = py2exe_util.get_sysdir()
windir = py2exe_util.get_windir()
# This is the tail of the path windows uses when looking for dlls
# XXX On Windows NT, the SYSTEM directory is also searched
exedir = os.path.dirname(sys.executable)
syspath = os.environ['PATH']
loadpath = ';'.join([exedir, sysdir, windir, syspath])
# Found by Duncan Booth:
# It may be possible that bin_depends needs extension modules,
# so the loadpath must be extended by our python path.
loadpath = loadpath + ';' + ';'.join(pypath)
Can you try to change the last line into
loadpath = ';'.join(pypath) + ';' + loadpath
and report if this helps?
Thanks,
Thomas
More information about the Python-list
mailing list