mirror of
https://github.com/jlu5/SupyPlugins.git
synced 2025-04-26 04:51:08 -05:00
accountsdb: use shutil.move instead of os.rename
On Windows, os.rename will error if the destination exists
This commit is contained in:
parent
79a4453875
commit
edeb892db1
@ -1,4 +1,4 @@
|
|||||||
# Autogenerated by update-modules.py on Sat Mar 9 12:35:58 2019 - DO NOT EDIT THIS COPY DIRECTLY!
|
# Autogenerated by update-modules.py on Thu Apr 27 23:26:05 2023 - DO NOT EDIT THIS COPY DIRECTLY!
|
||||||
###
|
###
|
||||||
# Copyright (c) 2019, James Lu <james@overdrivenetworks.com>
|
# Copyright (c) 2019, James Lu <james@overdrivenetworks.com>
|
||||||
# All rights reserved.
|
# All rights reserved.
|
||||||
@ -91,7 +91,7 @@ class AccountsDB():
|
|||||||
try:
|
try:
|
||||||
with open(tmp_filename, 'wb') as f:
|
with open(tmp_filename, 'wb') as f:
|
||||||
pickle.dump(self.db, f, 2)
|
pickle.dump(self.db, f, 2)
|
||||||
os.rename(tmp_filename, self.filename)
|
shutil.move(tmp_filename, self.filename)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
log.exception('%s: Unable to write database: %s', self._plugin_name, e)
|
log.exception('%s: Unable to write database: %s', self._plugin_name, e)
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
# Autogenerated by update-modules.py on Sat Mar 9 12:35:58 2019 - DO NOT EDIT THIS COPY DIRECTLY!
|
# Autogenerated by update-modules.py on Thu Apr 27 23:26:05 2023 - DO NOT EDIT THIS COPY DIRECTLY!
|
||||||
###
|
###
|
||||||
# Copyright (c) 2019, James Lu <james@overdrivenetworks.com>
|
# Copyright (c) 2019, James Lu <james@overdrivenetworks.com>
|
||||||
# All rights reserved.
|
# All rights reserved.
|
||||||
@ -91,7 +91,7 @@ class AccountsDB():
|
|||||||
try:
|
try:
|
||||||
with open(tmp_filename, 'wb') as f:
|
with open(tmp_filename, 'wb') as f:
|
||||||
pickle.dump(self.db, f, 2)
|
pickle.dump(self.db, f, 2)
|
||||||
os.rename(tmp_filename, self.filename)
|
shutil.move(tmp_filename, self.filename)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
log.exception('%s: Unable to write database: %s', self._plugin_name, e)
|
log.exception('%s: Unable to write database: %s', self._plugin_name, e)
|
||||||
|
|
||||||
|
@ -90,7 +90,7 @@ class AccountsDB():
|
|||||||
try:
|
try:
|
||||||
with open(tmp_filename, 'wb') as f:
|
with open(tmp_filename, 'wb') as f:
|
||||||
pickle.dump(self.db, f, 2)
|
pickle.dump(self.db, f, 2)
|
||||||
os.rename(tmp_filename, self.filename)
|
shutil.move(tmp_filename, self.filename)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
log.exception('%s: Unable to write database: %s', self._plugin_name, e)
|
log.exception('%s: Unable to write database: %s', self._plugin_name, e)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user