Python Error from Apress book

matt0177 matt0177 at GMAIL.COM
Mon Jul 6 18:56:40 EDT 2009 

The two above files are from chapter 20 of the Apress book "Beginning Python
>From Novice to Professional". When I try to run the command as outlined in
the book " < test_input.txt > test_output.html i get the
following error every time.

File "C:\Python25\Scripts\", line 7, in <module> for block
in blocks(sys.stdin):
File "C:\Python25\Scripts\", line 7, in blocks for line in
File "C:\Python25\Scripts\", line 2, in lines for line in file:
yield line
IOError: [Errno 9] Bad file descriptor

I've tried this code on two different computers (both winxp, python 2.5.1)
with the same results. when is run with only output, it
will correctly write the headers. When you try to add an input file, you get
the error every time, and I have tried every text file known to man,
including the downloadable sample. This has been frustrating me for several
days, any advice would be greatly appreciated. I'm just starting to learn
python so troubleshooting is a sorely lacked skill atm :)



View this message in context:
Sent from the Python - python-list mailing list archive at

More information about the Python-list mailing list