You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Running Python from within a Windows Git SCM shell (MINGW64; which includes file support), it appears the import of the magic module would always fail to load. The typical error would be a Segmentation fault; however, sometimes the error state would vary (either hanging forever or another error). This script (just the import):
import magic
Tweaked the magic library to see where it was failing:
After installing the python-magic-bin package, this module worked as expected.
Loaded up a real MinGW-w64 environment, installed file (and manually deleted their broken magic.py), and installed python-magic — the magic module worked as expected.
Originally, I assumed msys-magic-1.dll library provided by Git SCM is built in a way which is invalid for the Python interpreter to load. Checking to make sure it wasn't a specific interpreter version, I made a simple DLL load script to see if the DLL could be loaded and tested on a couple of interpreters (3.7, 3.8, 3.10 and 3.11):
Granted, these changes are not really good for long term. Had to stop investigating after this. Don't know if anyone has any suggestions/comments on this. I'll try to find time later to continue this investigation (unless someone else beats me to it).
(python-magic 0.4.27, Git SCM 2.40.1, Windows 22H2)
The text was updated successfully, but these errors were encountered:
Can you explicitly setting PATH to control where the DLL is being searched for? I'm not sure what the right solution is here other than avoiding loading the library entirely.
Running Python from within a Windows Git SCM shell (MINGW64; which includes
file
support), it appears the import of themagic
module would always fail to load. The typical error would be aSegmentation fault
; however, sometimes the error state would vary (either hanging forever or another error). This script (just the import):Tweaked the magic library to see where it was failing:
Segmentation fault
Internal error
After installing the
python-magic-bin
package, this module worked as expected.Loaded up a real MinGW-w64 environment, installed
file
(and manually deleted their brokenmagic.py
), and installed python-magic — the magic module worked as expected.Originally, I assumed
msys-magic-1.dll
library provided by Git SCM is built in a way which is invalid for the Python interpreter to load. Checking to make sure it wasn't a specific interpreter version, I made a simple DLL load script to see if the DLL could be loaded and tested on a couple of interpreters (3.7, 3.8, 3.10 and 3.11):From these checks, it looked like all interpreters were able to load the DLL:
Hacking around, it looks that I was able to use the magic module in this environment (i.e. without
python-magic-bin
) by doing two steps:_add_compat(globals())
from python-magic's__init__.py
script; and,Granted, these changes are not really good for long term. Had to stop investigating after this. Don't know if anyone has any suggestions/comments on this. I'll try to find time later to continue this investigation (unless someone else beats me to it).
(python-magic 0.4.27, Git SCM 2.40.1, Windows 22H2)
The text was updated successfully, but these errors were encountered: