IOError: (0,"Error") when closing "os.popen"ed file?
Rob W. W. Hooft
rob at hooft.net
Mon Jan 31 09:58:47 EST 2000
>>>>> "AE" == Adrian Eyre <a.eyre at optichrome.com> writes:
>> After hacking for a while, I managed to work around the problem by
>> doing:
>>
>> time.sleep(0.1) f.close()
>>
>> But this is highly unsatisfactory..... Is there anyone that can
>> give me a better suggestion?
AE> I expect the OS hasn't finished with the file before it receives
AE> the close().
AE> Try replacing "time.sleep(0.1)" with "f.flush()". IIRC flush()
AE> blocks untils the file operation has completed.
Actually I have seen the same error message from a f.flush() before,
so I already had coded:
try:
f.flush()
except IOError:
pass
But maybe I should repeat the flush() until it succeeds, and only
then close() the file. Since I wrote my first message I have already
found occasions where even the sleep(0.1) doesn't solve the problem.
Bad. I really hope I can properly fix this.
Rob
--
===== rob at hooft.net http://www.xs4all.nl/~hooft/rob/ =====
===== R&D, Nonius BV, Delft http://www.nonius.nl/ =====
===== PGPid 0xFA19277D ========================== Use Linux! =========
More information about the Python-list
mailing list