In article <[EMAIL PROTECTED]>,
Andrew Robert  <[EMAIL PROTECTED]> wrote:
>[EMAIL PROTECTED] wrote:
>> hello --
>> 
>> i'm running python/pygame on maemo (nokia 770). my situation is that
>> i'm continually scouring this one directory for incoming files. if i
>> see if there's a new file (coming in via wireless scp), i proceed to
>> load it and process it.
>> 
>> however, i think i am running into the issue that my program starts to
>> load the file after it recognises there is new data, but before the
>> file has completely transferred, so at unpredictable times i get a
>> pygame.error: Error reading from datastream.
>> 
>> what is the easiest way to work out this issue? easy being the key
>> word. :) thank you very much!
>> 
>> christine
>> 
>
>You might want to test for file locking before attempting to use


Or, really crude - when you see the file, record the time and the file
size, but don't attempt to process it yet. Wait for a short interval,
then check the size again. If it's changed, wait again. When it gives
the same size after a delay period, assume all the data is there. 

This isn't a good method, but it's simple to implement and will reduce
the occurrence of attempts to process a file which is still in
transit/

-- 
Jim Segrave           ([EMAIL PROTECTED])

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to