pdf2exe trouble
Thomas Heller
theller at python.net
Mon Nov 3 15:26:12 EST 2003
Maxim Khesin <max at cNvOiSsiPoAnMtech.com> writes:
> I got into some hot waterhere:
> I have a service writted in Python (py2exe-wrapped) that worked ok
> with 2.2. I upgraded to 2.3 and got an "IOException bad file
> descriptor" in a
> print "something"
> line. I used 'import trace' at the top of the file and
(I assume you mean 'import win32traceutil' here)
> used to be able to see the print statements in win32traceutil
> window. I uncommented 'import trace' and got the same ting. Does
> anyone have an idea/advice as to get the print to go to normal trace
> route or do something else reasonable short of removing the print
> statements (which is what I basically did)?
> thanx.
> max.
Which version of py2exe are you using? If it's 0.4.x, the same code is
used for Python 2.2 and 2.3, so I cann explain the different behaviour
you observe.
But I've seen these IOErrors also.
win32traceutil, when imported as a module, reassigns sys.stdout and
sys.stderr, if I understand the code correctly. As you say, things
work when you import win32traceutil, and break when you're not.
A simple solution would be to redirect sys.stdout and sys.stderr
yourself, before the possible import of win32traceutil. Something like
this should work - it simply thows away any output (in some cases it
should be more useful to write to a logfile):
class Null:
def write(self, msg):
pass
import sys
sys.stdout = sys.stderr = Null()
import win32traceutil # comment this out when debugging is done
Thomas
More information about the Python-list
mailing list