Ricardo Aráoz wrote:
Emile van Sebille wrote:
I've done this and it works well... one thing to watch out for though is snagging a file before it's completely written. Setting up a semaphore or pausing to allow the file write to complete once seeing the file fixes it adequately.


If instead of an input/output file you use a directory this is easily solved. You write your request to a uniquely named file (with .in extension)

But that doesn't solve the problem. If you have a lot of data to be written to the '.in' file you need to wait for the file writes to complete before reading the contents on the 'other' side. File existence isn't sufficient. Perhaps writing to a '.tmp' and renaming it to '.in' after completely written might do it without the possibility of consuming the partial file before it's ready.


Emile

_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to