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

BytesIO object instead of file path --> TypeError #44

Closed
OBrink opened this issue Jun 9, 2023 · 0 comments · Fixed by #45
Closed

BytesIO object instead of file path --> TypeError #44

OBrink opened this issue Jun 9, 2023 · 0 comments · Fixed by #45
Assignees
Labels
bug Something isn't working enhancement New feature or request

Comments

@OBrink
Copy link
Collaborator

OBrink commented Jun 9, 2023

If a BytesIO object is handed to the predict_SMILES function, the following error occurs. This used to work without any problems.

It seems like this behaviour has been introduced with the HEIC/HEIF compatibility. Can we check for the image type differently without checking for 'HEIC' in the name?

 File "/home/otto/.local/lib/python3.8/site-packages/DECIMER/decimer.py", line 109, in predict_SMILES
    chemical_structure = config.decode_image(image_path)
  File "/home/otto/.local/lib/python3.8/site-packages/DECIMER/config.py", line 197, in decode_image
    img = remove_transparent(image_path)
  File "/home/otto/.local/lib/python3.8/site-packages/DECIMER/config.py", line 110, in remove_transparent
    if pathlib.Path(image_path).suffix == ".HEIC":
  File "/usr/lib/python3.8/pathlib.py", line 1042, in __new__
    self = cls._from_parts(args, init=False)
  File "/usr/lib/python3.8/pathlib.py", line 683, in _from_parts
    drv, root, parts = self._parse_args(args)
  File "/usr/lib/python3.8/pathlib.py", line 667, in _parse_args
    a = os.fspath(a)
TypeError: expected str, bytes or os.PathLike object, not _io.BytesIO
@OBrink OBrink added bug Something isn't working enhancement New feature or request labels Jun 9, 2023
@Kohulan Kohulan self-assigned this Jun 9, 2023
Kohulan added a commit that referenced this issue Jun 9, 2023
@Kohulan Kohulan linked a pull request Jun 9, 2023 that will close this issue
Kohulan added a commit that referenced this issue Jun 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants