fileinput.input() fails on Windows 2K
Ingo Blank
spam at yourself.com
Sun Apr 28 13:04:34 EDT 2002
Hi,
this tiny script gives a traceback under Windows 2K if/when input is piped
in to stdin, while it runs as expected under Linux.
## MakeDef.py
## Read ouput of DUMPBIN /EXPORTS <file.DLL> and create a .DEF file
from string import *
import fileinput
print "EXPORTS"
hit = 0
for line in fileinput.input():
words = split(line)
if hit and len(words) == 4:
print "\t%s" % words[3]
hit |= find(line,"RVA") >= 0
----------------
C:>DUMPBIN /EXPORTS libjpeg.dll | MakeDEF.py
Traceback (most recent call last):
File "C:\MakeDEF.py", line 6, in ?
for line in fileinput.input():
File "E:\Python21\lib\fileinput.py", line 181, in __getitem__
line = self.readline()
File "E:\Python21\lib\fileinput.py", line 262, in readline
self._buffer = self._file.readlines(self._bufsize)
IOError: [Errno 9] Bad file descriptor
-----------------
Am I missing something, or is this a bug in fileinput.py ?
I'm using ActiveState Python 2.1.
--ingo
voy NG arktb QBG qr [ rot13 ]
PGP PublicKey
http://keys.pgp.com:11371/pks/lookup?op=get&search=0x18B44974
More information about the Python-list
mailing list