mirror of
https://github.com/internetarchive/warcprox.git
synced 2025-01-18 13:22:09 +01:00
Merge pull request #142 from vbanos/fix-close-rename
Another exception when trying to close a WARC file
This commit is contained in:
commit
22d786f72e
@ -170,11 +170,14 @@ class WarcWriter:
|
|||||||
except Exception as exc:
|
except Exception as exc:
|
||||||
self.logger.error(
|
self.logger.error(
|
||||||
'could not unlock file %s (%s)', self.path, exc)
|
'could not unlock file %s (%s)', self.path, exc)
|
||||||
self.f.close()
|
try:
|
||||||
finalpath = os.path.sep.join(
|
self.f.close()
|
||||||
[self.directory, self.finalname])
|
finalpath = os.path.sep.join(
|
||||||
os.rename(self.path, finalpath)
|
[self.directory, self.finalname])
|
||||||
|
os.rename(self.path, finalpath)
|
||||||
|
except Exception as exc:
|
||||||
|
self.logger.error(
|
||||||
|
'could not close and rename file %s (%s)', self.path, exc)
|
||||||
self.path = None
|
self.path = None
|
||||||
self.f = None
|
self.f = None
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user