get the size of a dynamically changing file fast ?

Stef Mientki stef.mientki at gmail.com
Thu Jan 17 16:56:16 EST 2008


hello,

I've a program (not written in Python) that generates a few thousands 
bytes per second,
these files are dumped in 2 buffers (files), at in interval time of 50 msec,
the files can be read by another program, to do further processing.

A program written in VB or delphi can handle the data in the 2 buffers 
perfectly.
Sometimes Python is also able to process the data correctly,
but often it can't :-(

I keep one of the files open en test the size of the open datafile each 
50 msec.
I have tried
    os.stat ( ....) [ ST_SIZE]
    os.path.getsize ( ... )
but they both have the same behaviour, sometimes it works, and the data 
is collected each 50 .. 100 msec,
sometimes 1 .. 1.5 seconds is needed to detect a change in filesize.

I'm using python 2.4 on winXP.

Is there a solution for this problem ?

thanks,
Stef Mientki



More information about the Python-list mailing list