January 5th, 2009 How to unlock urllib files ?
I've tried a delay loop to retry the delete but no matter what the wait period is it remains locked.
Could it be that the file is readonly until download completion, as it can be deleted if not cancelled ?
Any ideas?
Thanks
BBB
this is what i use and it works fine.
except:
urllib.urlcleanup()
remove_tries = 3
while remove_tries and os.path.isfile( filepath ):
try:
os.remove( filepath )
except:
remove_tries -= 1
xbmc.sleep( 1000 )
for count in range(5):
try:
os.remove( file_name )
break
except OSError:
time.sleep(0.2)
except:
break
In the code before this is called I do also do a urllib.urlcleanup()
Notice I use time.sleep and not xbmc.sleep Which is preferred? Maybe the longer xbmc sleep makes the difference ?
I'll try your code and see what happens.
cheers
BBB
#If you have any other info about this subject , Please add it free.# |