-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Upload file = NameError: name 'magic' is not defined on MacOS #3098
Comments
You beat me to it. Same error here without reverse proxy. Running on MacOS Sonoma, everything latest version. |
Release notes have this at the top:
So that's almost certainly why. I don't remember updating, but since I'm on a version that came out two days ago, clearly I did. A mystery. |
Thank you for the quick reply. I thought I did everything right, but I think I might need help. I actually did install all 3 modules using (pip install regex), (pip install bleach), and (pip install python-magic). These are taken staright from the Terminal: |
I am about to be gone for a week and needed it working asap, so I decided to be extra lazy and fix it by pointing to 0.6.21 instead of latest and installing extra stuff on my server. Your guess is as good as mine, best of luck! |
Not sure if this helps, but here is the error trace upon attempting to upload a file: Calibre-Web
|
@enaloha: Could you please update to the newest nightly version and check your calibre-web.log. I guess there will be an entry: The easy workaround is to deactivate "Check if file extensions matches file content on upload" in admin -> basic configuration -> security settings". But I would really appreciate it if you could help me to fix the problem. |
@enaloha: If I',m right then the solution could be this one: (In this case I would add a message in the log pointing to the solution) |
I switched to nightly builds (current version is now 7/8/24 3:04 AM. The weblog does NOT include "Cannot import python-magic, checking uploaded file metadata will not work: failed to find libmagic. Check your installation". The only text related to magic is pasted below: File "/opt/calibre-web/cps/file_helper.py", line 49, in validate_mime_type
NameError: name 'magic' is not defined |
I think I know why, the message is logged before the logging routine is properly set up. |
I just reinstalled libmagic via brew and that fixed the issue. I am now able to upload books. Thanks for your help. |
A windows solution can be found here #2875 for those still having this issue (edit) adding this because this is the top google result for this error |
I ran into this issue on Windows 10. Switching to Python 3.9 and installing the DLLs for libmagic with |
Attempting to upload a file immediately causes an error.
Steps to reproduce the behavior:
I'm using Nginx as a reverse proxy, but that probably isn't relevant since it does the same thing from localhost:port.
The last time I uploaded a file was May 28th, just over a month ago.
The text was updated successfully, but these errors were encountered: