-
Notifications
You must be signed in to change notification settings - Fork 378
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FileExistsError does not exist in Python 2 #459
Comments
Thanks for reporting! what would be the exception in Python 2? |
Thanks for the response! Something like OSError I would assume? See https://stackoverflow.com/questions/20790580/python-specifically-handle-file-exists-exception |
As far as I know, import sys
import os
# from sacred.utils import FileExistsError
if sys.version_info[0] == 2:
import errno
class FileExistsError(OSError):
def __init__(self, msg):
super(FileExistsError, self).__init__(errno.EEXIST, msg)
try:
os.mkdir('dummy')
except FileExistsError:
print('catched')
else:
print('not catched')
|
FileExistsError was only added in Python 3. If an exception is thrown by mkdir, then the exception is not caught and properly dealt with.
sacred/sacred/observers/file_storage.py
Line 106 in ee8d44f
The text was updated successfully, but these errors were encountered: