buffering choking sys.stdin.readlines() ?
cshirky
cshirky at gmail.com
Mon May 12 11:05:39 EDT 2008
Newbie question:
I'm trying to turn a large XML file (~7G compressed) into a YAML file,
and my program seems to be buffering the input.
IOtest.py is just
import sys
for line in sys.stdin.readlines():
print line
but when I run
$ gzcat bigXMLfile.gz | IOtest.py
but it hangs then dies.
The goal of the program is to build a YAML file with print statements,
rather than building a gigantic nested dictionary, but I am obviously
doing something wrong in passing input through without buffering. Any
advice gratefully fielded.
-clay
More information about the Python-list
mailing list