Opened 8 years ago

Closed 8 years ago

#44 closed defect (fixed)

Windows: print may raise an exception under pythonw.exe

Reported by: flip Owned by: flip
Priority: minor Milestone:
Component: other Version:
Keywords: Cc:


Under Windows, when an app that runs under pythonw.exe prints more than 4096 bytes to stdout/stderr, Python raises a "Bad file descriptor" error. This is working as desgined, although there's been a Python ticket open on it since 2003:

End users (non-developers) under Windows use pythonw.exe launch our apps from a Desktop icon. The advantage of pythonw.exe over regular python.exe is that it doesn't open a console window to execute the app. However, under pythonw.exe, stdout and stderr are apparently fixed-size buffers that fill up after 4096 bytes.

In practice this hasn't been a problem for us because we don't print to the console during normal operations. But I happened to add some print statements in a loop (==> lots of debug output) while hacking a version of Vespa that I installed from the standard bundle, and I ran into this error.

There's a workaround in the ticket referenced above (see msg97442) and I think it's worth applying to Vespa. I doubt we'll run into this problem again, but it's really confusing if you do. One or two print statements don't cause a problem, but adding several of them (or one in a loop) does.

In addition, we can add the verbose_oc flag to vespa.ini to print lots of optimal control info to the console. Enabling that flag and running under pythonw.exe would surely raise an error.

Change History (1)

comment:1 Changed 8 years ago by flip

  • Resolution set to fixed
  • Status changed from new to closed

Fixed in r3479.

Note: See TracTickets for help on using tickets.