I'm afraid I can't suggest a work-around (other than the obvious "catch the AttributeError"), but would be happy to look at a patch that adds such an attribute.
Mark > -----Original Message----- > From: TK Soh [mailto:[EMAIL PROTECTED] > Sent: Monday, 19 November 2007 11:06 PM > To: Mark Hammond > Cc: Python-Win32 List; Steve Borho > Subject: Re: [python-win32] win32tracutil traceback on Vista > > On Nov 19, 2007 7:56 PM, Mark Hammond <[EMAIL PROTECTED]> > wrote: > > > While we are here, is it possible to add a 'closed' attribute to > > > win32trace also, as I mention in an earlier post to the list? > > > > Sure - although I'm afraid your earlier post has been lost (by me). > > Adding a patch to the pywin32 project at sourceforge is probably the > > best way to ensure that doesn't happen in the future... > > My original post is as below: > > It looks like the "closed" attribute for sys.stderr and sys.stdout are > missing when win32trace is in effect. Any way to work around this? > > python script: > -------------------------- > import win32traceutil > import sys > if not sys.stdout.closed: > print "stdout is opened" > -------------------------- > > Trace collector output: > -------------------------- > Traceback (most recent call last): > File "try.py", line 3, in <module> > if not sys.stdout.closed: > AttributeError: 'PyTraceObject' object has no attribute 'closed' _______________________________________________ python-win32 mailing list python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32