this should fix the bug on windows
This commit is contained in:
parent
7e225fcf7d
commit
a502d8d28c
1 changed files with 12 additions and 2 deletions
|
@ -88,10 +88,20 @@ class OptionsParser:
|
||||||
fd.close()
|
fd.close()
|
||||||
return err_str
|
return err_str
|
||||||
fd.close()
|
fd.close()
|
||||||
|
if os.path.exists(self.__filename):
|
||||||
|
try:
|
||||||
|
os.remove(self.__filename)
|
||||||
|
except:
|
||||||
|
pass
|
||||||
try:
|
try:
|
||||||
os.rename(self.__tempfile, self.__filename)
|
os.rename(self.__tempfile, self.__filename)
|
||||||
except:
|
except Exception, e:
|
||||||
err_str = _('Unable to open %s for writing\n') % (self.__filename)
|
err_str = _('Unable to open %s for writing.\n') % (self.__filename)
|
||||||
|
# write the exception in case the bug continue to exists on
|
||||||
|
# windows
|
||||||
|
# TODO remove the following 2 lines
|
||||||
|
from sys import stderr
|
||||||
|
stderr.write(err_str + str(e) + '\n')
|
||||||
return err_str
|
return err_str
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue