Hi All
I've written a simple python script that accepts both stdin and a glob (or
at least, that is the plan).
Unfortunately, the glob part seems to hang when it's looped through to the
end of the filehandle.
And I have no idea why... ;-)
sys.stdin and a normal file opened with open seem to
Hi Chris
2009/2/5 Chris Rebert c...@rebertia.com
I'd add some print()s in the above loop (and also the 'for f in files'
loop) to make sure the part of the code you didn't want to share (do
stuff with the line) works correctly, and that nothing is improperly
looping in some unexpected way.
On Thu, Feb 5, 2009 at 2:58 AM, Simon Mullis si...@mullis.co.uk wrote:
Hi All
I've written a simple python script that accepts both stdin and a glob (or
at least, that is the plan).
Unfortunately, the glob part seems to hang when it's looped through to the
end of the filehandle.
And I have
Forget it all... I was being very very daft!
The default = 'False' in the options for stdin was not being
evaluated as I thought, so the script was waiting for stdin even when
there was the glob switch was used...No stdin equals the script
seeming to hang.
Ah well.
SM
--
Last try at getting the indenting to appear correctly..
#!/usr/bin/env python
import glob, os, sys
class TestParse(object):
def __init__(self):
if options.stdin:
self.scan_data(sys.stdin)
if options.glob:
self.files = glob.glob(options.glob)