[Trac-tickets] [The Trac Project] #2052: "Bad file descriptor" error setting binary I/O on Windows

The Trac Project noreply at edgewall.com
Tue Sep 13 04:33:38 CDT 2005


#2052: "Bad file descriptor" error setting binary I/O on Windows
--------------------------------+-------------------------------------------
 Reporter:  Juanma Barranquero  |       Owner:  jonas
     Type:  defect              |      Status:  new  
 Priority:  low                 |   Milestone:       
Component:  general             |     Version:  devel
 Severity:  normal              |   Keywords:  hooks windows       |  
--------------------------------+-------------------------------------------
 ''(This has been discussed on the mailing list, but AFAICS there's no
 ticket for it).''

 The following code from [source:trunk/trac/env.py env.py] originates in
 changes [412:413], commited to fix #244:
 {{{
 try: # Use binary I/O on Windows
     import msvcrt, sys
     msvcrt.setmode(sys.stdin.fileno(), os.O_BINARY)
     msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY)
 except ImportError:
     pass
 }}}

 However, it has the side effect that it bombs out with
 {{{
    File "C:\bin\python\lib\site-packages\trac\env.py", line 70, in
 __init__
     msvcrt.setmode(sys.stdin.fileno(), os.O_BINARY)
  IOError: [Errno 9] Bad file descriptor
 }}}
 on some cases (Windows hooks, running as a service, etc.), as apparently
 there are no {{{stdin}}}/{{{stdout}}} filehandles available.

-- 
Ticket URL: <http://projects.edgewall.com/trac/ticket/2052>
The Trac Project <http://trac.edgewall.com/>


More information about the Trac-Tickets mailing list