Python Error from Apress book

M

matt0177

http://www.nabble.com/file/p24364269/simple_markup2.py simple_markup2.py
http://www.nabble.com/file/p24364269/util2.py util2.py

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 "simple_markup2.py < test_input.txt > test_output.html i get the
following error every time.

File "C:\Python25\Scripts\simple_markup2.py", line 7, in <module> for block
in blocks(sys.stdin):
File "C:\Python25\Scripts\util2.py", line 7, in blocks for line in
lines(file):
File "C:\Python25\Scripts\util2.py", 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 simple_markup2.py 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 :)

Thanks,

Matt
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,070
Latest member
BiogenixGummies

Latest Threads

Top