pdf2exe trouble

M

Maxim Khesin

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
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.
 
T

Thomas Heller

Maxim Khesin said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,169
Messages
2,570,919
Members
47,460
Latest member
eibafima

Latest Threads

Top