atomicWrite Py3 support, full stack logging
This commit is contained in:
parent
f5bc26e9fe
commit
cd9a965057
1 changed files with 3 additions and 3 deletions
|
@ -25,11 +25,11 @@ def atomicWrite(dest, content, mode="wb"):
|
||||||
os.rename(dest + "-tmpnew", dest)
|
os.rename(dest + "-tmpnew", dest)
|
||||||
os.unlink(dest + "-tmpold") # Remove old file
|
os.unlink(dest + "-tmpold") # Remove old file
|
||||||
return True
|
return True
|
||||||
except Exception, err:
|
except Exception as err:
|
||||||
from Debug import Debug
|
from Debug import Debug
|
||||||
logging.error(
|
logging.error(
|
||||||
"File %s write failed: %s, reverting..." %
|
"File %s write failed: %s, (%s) reverting..." %
|
||||||
(dest, Debug.formatException(err))
|
(dest, Debug.formatException(err), Debug.formatStack())
|
||||||
)
|
)
|
||||||
if os.path.isfile(dest + "-tmpold") and not os.path.isfile(dest):
|
if os.path.isfile(dest + "-tmpold") and not os.path.isfile(dest):
|
||||||
os.rename(dest + "-tmpold", dest)
|
os.rename(dest + "-tmpold", dest)
|
||||||
|
|
Loading…
Reference in a new issue