mirror of
https://github.com/clinton-hall/nzbToMedia.git
synced 2025-08-20 21:33:13 -07:00
Add exception handling for failure to return to original directory
Fixes #1552
This commit is contained in:
parent
45baf79753
commit
fd8452b5c6
1 changed files with 11 additions and 1 deletions
12
cleanup.py
12
cleanup.py
|
@ -33,7 +33,17 @@ class WorkingDirectory(object):
|
|||
return self
|
||||
|
||||
def __exit__(self, exc_type, exc_val, exc_tb):
|
||||
os.chdir(self.original_directory)
|
||||
try:
|
||||
os.chdir(self.original_directory)
|
||||
except OSError as error:
|
||||
print(
|
||||
'Unable to return to {original_directory}: {error}\n'
|
||||
'Continuing in {working_directory}'.format(
|
||||
original_directory=self.original_directory,
|
||||
error=error,
|
||||
working_directory=self.working_directory,
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
def module_path(module=__file__, parent=False):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue