parent
72cf6a8c07
commit
cffac66393
|
@ -261,7 +261,7 @@ class FileInput:
|
||||||
self._backupfilename = 0
|
self._backupfilename = 0
|
||||||
if backupfilename and not self._backup:
|
if backupfilename and not self._backup:
|
||||||
try: os.unlink(backupfilename)
|
try: os.unlink(backupfilename)
|
||||||
except: pass
|
except OSError: pass
|
||||||
|
|
||||||
self._isstdin = False
|
self._isstdin = False
|
||||||
self._buffer = []
|
self._buffer = []
|
||||||
|
@ -301,7 +301,7 @@ class FileInput:
|
||||||
self._file = open(self._backupfilename, "r")
|
self._file = open(self._backupfilename, "r")
|
||||||
try:
|
try:
|
||||||
perm = os.fstat(self._file.fileno()).st_mode
|
perm = os.fstat(self._file.fileno()).st_mode
|
||||||
except:
|
except OSError:
|
||||||
self._output = open(self._filename, "w")
|
self._output = open(self._filename, "w")
|
||||||
else:
|
else:
|
||||||
fd = os.open(self._filename,
|
fd = os.open(self._filename,
|
||||||
|
@ -310,7 +310,7 @@ class FileInput:
|
||||||
self._output = os.fdopen(fd, "w")
|
self._output = os.fdopen(fd, "w")
|
||||||
try:
|
try:
|
||||||
os.chmod(self._filename, perm)
|
os.chmod(self._filename, perm)
|
||||||
except:
|
except OSError:
|
||||||
pass
|
pass
|
||||||
self._savestdout = sys.stdout
|
self._savestdout = sys.stdout
|
||||||
sys.stdout = self._output
|
sys.stdout = self._output
|
||||||
|
|
Loading…
Reference in New Issue