How to determine if a file is busy?

Benjamin Niemann b.niemann at betternet.de
Fri Oct 8 07:48:45 EDT 2004


How about writing the data to a file 'mydata.new' and when you are finished, 
delete 'mydata' and rename 'mydata.new' to 'mydata'.
This way the python script will always get 'complete' files (and sometimes no 
file at all, when it come in between rm and mv ...)

Busyman wrote:
> Hi,
> 
> I have written a stay-open-AppleScript for Mac OS X, gathering certain
> informations from different apps, which can only be gathered via
> AppleScript. This script writes its informations into a simple text
> file, every 15 seconds. And a python script is supposed to read this
> text file on a regular basis in order to feed the aquired datat into a
> database working only on Windows. Now the problem: How can I prevent
> that the python script reads the content of the text file, while my
> AppleScripts writes new information to it? Is there any 'busy'-status
> for files?
> 
> Thanks in advance from cold and cloudy Germany!
> 
> Martin



More information about the Python-list mailing list