8000 Installing version 1.7.0 on Windows · Issue #324 · zooniverse/panoptes-python-client · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
8000

Installing version 1.7.0 on Windows #324

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

Open
PmasonFF opened this issue Mar 26, 2025 · 0 comments
Open

Installing version 1.7.0 on Windows #324

PmasonFF opened this issue Mar 26, 2025 · 0 comments

Comments

@PmasonFF
Copy link

The uploader in question stores the compress media file as a file_bytes io.BytesIO() file object, then attempts to add_location. This works fine with panoptes version 1.61. and 1.6.2 on windows (all be it with a libmagic WARNING). It now fails with an error:

Two cases:

Updating a Python 3.10 environment to version 1.7 on a windows machine throws this error:
Traceback (most recent call last):
File "C:\py_scripts\Scripts_Skunks\subject_uploader_tree_variable_resize_grouped_3revised_02-03-2023.py", line 203, in
subject.add_location(file_bytes)
File "C:\Users\User1\AppData\Local\Programs\Python\Python310\lib\site-packages\panoptes_client\subject.py", line 272, in add_location
media_type = magic.from_buffer(media_data, mime=True)
AttributeError: module 'magic' has no attribute 'from_buffer'

Workaround:
installing python-magic-bin after the update seems to fix it.

A clean install with Python 3.12 and installing panoptes-client 1.7.0 fails with another error:

Traceback (most recent call last):
File "C:\py_scripts _with_venv\Scripts_python_3.13\subject_uploader_tree_variable_resize_grouped_3revised_02-03-2023.py", line 203, in
subject.add_location(file_bytes)
File "C:\py_scripts _with_venv\Scripts_python_3.13\venv\Lib\site-packages\panoptes_client\subject.py", line 274, in add_location
media_type = mimetypes.guess_type(location)[0]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\User1\AppData\Local\Programs\Python\Python311\Lib\mimetypes.py", line 307, in guess_type
return _db.guess_type(url, strict)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\User1\AppData\Local\Programs\Python\Python311\Lib\mimetypes.py", line 122, in guess_type
url = os.fspath(url)
^^^^^^^^^^^^^^
TypeError: expected str, bytes or os.PathLike object, not BytesIO

Workaround:
Again fixing the libmagic with installing python-magic-bin resolves the issue.

So you have gone from having a libmagic warning with a standard install of panoptes client on a Windows machine to a full error situation - at least when the add-location refers to a BytesIO object - likely because the fall back mime type solution does not work with BytesIO????

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
0