mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
ignore errors when trying to delete temporary files.
This commit is contained in:
parent
a8cfef8a60
commit
f37d8c9dc4
@ -42,10 +42,13 @@ class _TemporaryFileWrapper(object):
|
||||
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…
x
Reference in New Issue
Block a user