Closed francesco1119 closed 6 years ago
This probably means it can't find the magic file that defines all the file types. Try passing it in explicitly to the constructor of magic.Magic.
On Tue, Feb 13, 2018 at 12:09 AM, Francesco Mantovani < notifications@github.com> wrote:
I'm using your library for my Python3 script. It works very well on Windows 10 Linux bash but when I switch back to Windows 10 Command Prompt the same script is not working.
Traceback (most recent call last): File "Pukeko.py", line 159, in
dirlist(path) File "Pukeko.py", line 155, in dirlist dirlist(i) File "Pukeko.py", line 151, in dirlist LetsTry(i) File "Pukeko.py", line 127, in LetsTry elif "text" in magic.from_file(p, mime=True): File "C:\Users\franc\Miniconda3\lib\site-packages\python_magic-0.4.15-py3.6.egg\magic.py", line 135, in from_file File "C:\Users\franc\Miniconda3\lib\site-packages\python_magic-0.4.15-py3.6.egg\magic.py", line 123, in _get_magic_type File "C:\Users\franc\Miniconda3\lib\site-packages\python_magic-0.4.15-py3.6.egg\magic.py", line 67, in init File "C:\Users\franc\Miniconda3\lib\site-packages\python_magic-0.4.15-py3.6.egg\magic.py", line 264, in magic_load File "C:\Users\franc\Miniconda3\lib\site-packages\python_magic-0.4.15-py3.6.egg\magic.py", line 195, in errorcheck_negative_one magic.MagicException: None I think this is mainly due to the fact that on Windows I'm using Miniconda.
[image: evidence] https://user-images.githubusercontent.com/3397477/36139384-2afd0422-1102-11e8-82be-ed4cf353f28c.PNG
Is there any workaround?
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/ahupp/python-magic/issues/160, or mute the thread https://github.com/notifications/unsubscribe-auth/AACekgiJQJYE0D71rZP-8Kp8p9K4APZLks5tUUNAgaJpZM4SDW4L .
-- Adam Hupp | http://hupp.org/adam/
i have the same problem When I indicate explicitly: i get correct output:
but in Django project the same code:
it's just txt file
@polnikov can you use procmon to look at what is being opened (both the magic DLL and the magic DB file) in those two examples? My guess is that one or both are different due to slightly different paths.
I'm using your library for my Python3 script. It works very well on Windows 10 Linux bash but when I switch back to Windows 10 Command Prompt the same script is not working.
I think this is mainly due to the fact that on Windows I'm using Miniconda.
Is there any workaround?