Re: popen usage

2001-07-05 Thread Arthur Lee
Perhaps it should have been the following? : 1:    stdin=os.popen('tail -f somefile') 2:    logline=re.compile('(.*?).*?- - \[(.*?)\] "(.*?) (.*?)" (.*?) (.*?)"(.*?)" (.*?)".*') 3:    a=stdin.readline() 4:    print a 5:    while a: 6:    g=logline.search(a) 7:    if not g: continue 8:

RE: How to parse a binary file

2001-07-05 Thread Brian Quinlan
> I've never written a binary parser before, so I'm looking for > some starting point. You should probably start by checking out the struct module (http://www.python.org/doc/current/lib/module-struct.html). If you need a concrete usage example, please let me know. Cheers, Brian -- Brian Quinla

Re: [python-win32] How to parse a binary file

2001-07-05 Thread Jorgensen, Jens
David Ransier wrote: >I've never written a binary parser before, so I'm looking for some starting >point. > >I want to read an image file (Sun Raster format: RAS) and parse the included >color map, writing the color map as a text file (possible CSV format). > >I can open the file in "rb" mode and

How to parse a binary file

2001-07-05 Thread David Ransier
I've never written a binary parser before, so I'm looking for some starting point. I want to read an image file (Sun Raster format: RAS) and parse the included color map, writing the color map as a text file (possible CSV format). I can open the file in "rb" mode and read a certain number of byt

Re: popen usage

2001-07-05 Thread Phil Harris
Steve, Thanks for that, but I already know that tail -f doesn't finish. That's sort of the point. What I want is a long running (maybe neverending) stream to come back from the popen call. I would have thought that doing a readline on an ever growing file would indeed do as it says, read one l

RE: popen usage

2001-07-05 Thread steve
Readline is not SUPPOSED to finish! Here is what the manual says about tail -f regarding this: the tail command does not terminate after the last specified unit of the input file has been copied, but continues to read and copy additional units from the input file as they become available.

popen usage

2001-07-05 Thread Phil Harris
All, I have a script that uses popen to start an external process (tail -f) and allow me to read the results: 1:stdin=os.popen('tail -f somefile') 2:logline=re.compile('(.*?).*?- - \[(.*?)\] "(.*?) (.*?)" (.*?) (.*?) "(.*?)" "(.*?)".*') 3:a=stdin.readline() 4:print a 5:while