mirror of
git://github.com/kovidgoyal/calibre.git
synced 2025-12-28 20:16:05 +01:00
ignore errors when trying to delete temporary files.
This commit is contained in:
parent
a8cfef8a60
commit
f37d8c9dc4
1 changed files with 7 additions and 4 deletions
|
|
@ -42,10 +42,13 @@ def __getattr__(self, name):
|
|||
return a
|
||||
|
||||
def __del__(self):
|
||||
import os # Needs to be here as the main os may no longer exist
|
||||
self.close()
|
||||
if self.name and os.access(self.name, os.F_OK):
|
||||
os.remove(self.name)
|
||||
try:
|
||||
import os # Needs to be here as the main os may no longer exist
|
||||
self.close()
|
||||
if self.name and os.access(self.name, os.F_OK):
|
||||
os.remove(self.name)
|
||||
except: # An error just means that deleting of temporary file failed
|
||||
pass
|
||||
|
||||
|
||||
def PersistentTemporaryFile(suffix="", prefix="", dir=None):
|
||||
|
|
|
|||
Loading…
Reference in a new issue