Skip to content
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

'FileNotFoundError' object has no attribute 'message' #227

Open
haimat opened this issue Sep 24, 2020 · 0 comments
Open

'FileNotFoundError' object has no attribute 'message' #227

haimat opened this issue Sep 24, 2020 · 0 comments

Comments

@haimat
Copy link

haimat commented Sep 24, 2020

I noticed that sometimes during augmentation an image file cannot be saved:

Traceback (most recent call last):
  File "/usr/local/lib/python3.8/dist-packages/Augmentor/Pipeline.py", line 251, in _execute
    images[i].save(os.path.join(augmentor_image.output_directory, save_name))
  File "/usr/lib/python3/dist-packages/PIL/Image.py", line 2099, in save
    fp = builtins.open(filename, "w+b")
FileNotFoundError: [Errno 2] No such file or directory: 'MyImageFile.jpg'

But then this problem leads to another issue:

  File "/usr/local/lib/python3.8/dist-packages/Augmentor/Pipeline.py", line 370, in sample
    self._execute(augmentor_image)
  File "/usr/local/lib/python3.8/dist-packages/Augmentor/Pipeline.py", line 268, in _execute
    print("Error writing %s, %s. Change save_format to PNG?" % (file_name, e.message))
AttributeError: 'FileNotFoundError' object has no attribute 'message'

The Exception object does not have a message member.
So maybe you want to change line 268 to something like this:

print(f"Error writing {file_name}, {str(e)}. Change save_format to PNG?")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant