How to unlock urllib files ? - Printable Version +- Kodi Community Forum (https://forum.kodi.tv) +-- Forum: Development (https://forum.kodi.tv/forumdisplay.php?fid=32) +--- Forum: Add-ons (https://forum.kodi.tv/forumdisplay.php?fid=26) +--- Thread: How to unlock urllib files ? (/showthread.php?tid=30936) |
How to unlock urllib files ? - BigBellyBilly - 2008-01-29 I've come across a situation where if a urllib.retrieve download is cancelled (from a reporthook iscancelled check) the partially downloaded file can't be os.remove(file_name) as it throws an OSError errno 13 'permission denied' exception. 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 - Nuka1195 - 2008-01-29 did you try a loop? it seems to always fail the first time you try and remove it. this is what i use and it works fine. PHP Code: except: - BigBellyBilly - 2008-01-29 I currently have this: Code: for count in range(5): 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 |