Programming Forums

Programming Forums (http://www.programmingforums.org/forumindex.php)
-   Python (http://www.programmingforums.org/forum43.html)
-   -   Tailing a file? (http://www.programmingforums.org/showthread.php?t=10726)

titaniumdecoy Jul 14th, 2006 7:10 PM

Tailing a file?
 
There is a program I am working with that, attached to an external instrument, writes cryptic data to file for a few days. This data file is then run through another program which extracts the numeric data and writes it to an Excel file. If the numbers in this file are all within a certain range, the external instrument passed the test.

While the program is generating the data file (which takes a long, long time), I need to read the data that is being produced and stop the test if it has failed. What is the "safest" way to do this? I am on a Windows machine, so I assume there is no "tail" command. Is there a way to "stream" the data through my script as it is written to the file, or would it be better to read the file at regular intervals? If this is the case, how can I read the file without interrupting the program that is writing it?

DaWei Jul 14th, 2006 7:39 PM

Why don't you just write it to a file and to stdout or stderr.

titaniumdecoy Jul 14th, 2006 7:44 PM

I'm reading the output produced by what I believe is a commercial program, so I can't change the way it behaves. If that's what you mean...

DaWei Jul 14th, 2006 7:49 PM

Ahhh. I thought you wrote the program. Does it have an option to write to stdout, rather than a file? Then you could pipe it.

Pizentios Jul 18th, 2006 2:42 PM

this will probably work for you: http://aspn.activestate.com/ASPN/Coo.../Recipe/414771


All times are GMT -5. The time now is 8:14 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC