Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Re: python.exe vs pythonw.exe difference?

Reply
Thread Tools

Re: python.exe vs pythonw.exe difference?

 
 
Thomas Heller
Guest
Posts: n/a
 
      03-02-2004
"Tim Peters" <> writes:

> [moving this from comp.lang.python to zope-dev; it really belongs on a
> Zope list, although schemes to change what pythonw does probably belong
> on python-dev]


[I'm currently reading python-list via the gmane nntp interface, I don't
know whether there really is a gmane.comp.web.zope.devel newsgroup]

> [Thomas Heller]
>> It has been reported that writing to the original sys.stdout (and
>> maybe also sys.stderr) sooner or later raises an IOError when running
>> pythonw.exe, unless these are redirected. Could this be the problem?

>
> It could, although I have no idea what WinXP does (and don't have access to
> XP). Here's a Python program to try:
>
> """
> import sys
> if 1: # edit to 1 for stdout, 0 for stderr
> console = sys.stdout
> else:
> console = sys.stderr
>
> import traceback
> tb = file('tb.txt', 'w')
>
> try:
> i = 0
> while True:
> i += 1
> console.write('.')
> except:
> print >> tb, "Died when trying to write byte", i
> traceback.print_exc(file=tb)
> tb.close()
> """
>
> Under Win98SE, and regardless of whether it writes to stdout or stderr, it
> dies when run under pythonw, and tb.txt contains this after:
>
> Died when trying to write byte 4097
> Traceback (most recent call last):
> File "wr.py", line 14, in ?
> console.write('.')
> IOError: [Errno 9] Bad file descriptor


I get exactly the same, on Win XP Pro, both for sys.stdout and sys.stderr.

> The point of pythonw.exe is that no console is created or inherited, and the
> default stdin, stdout and stderr provided by MS C in that case are unusable
> (although the output flavors can appear to be usable until some secret MS
> limit is exceeded -- at least under Win98SE).


Since it seems XP shows the same behaviour than win98SE, has the
behaviour of Python changed? Were IOErrors ignored on sys.stdout or
sys.stderr in earlier versions?

IIRC, /F first proposed that pythonw.exe should create a console to have
a place to show tracebacks. Sounds like a good idea to me.

Thomas


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off




Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57