This is the mail archive of the
mailing list for the Cygwin project.
Re: Re: cygmagic-1.dll - access violation by accessing the lib via python
- From: "Holger Bast" <HolgerBast at gmx dot de>
- To: cygwin at cygwin dot com
- Date: Tue, 12 Jan 2016 15:01:23 +0100
- Subject: Re: Re: cygmagic-1.dll - access violation by accessing the lib via python
- Authentication-results: sourceware.org; auth=none
- References: <trinity-ec69c9bb-c7c8-4910-b745-c0aa14a3874a-1452547860856 at 3capp-gmx-bs63>, <20160112094843 dot GB15034 at calimero dot vinschen dot de>
- Sensitivity: Normal
that are good news!
I used the official Windows-edition of python trying to access Cygwin's libmagic. So deinstalling the Windows-edition and installing Cygwin's python solved my problem!
To run my script you need the external python package, not the wrapper that is shipped with Cygwin.
1) Installing pip (The PyPA recommended tool for installing Python packages.)
2) pip install pyhton-magic
3) run the script
But you don't have to do that... it works ;)
Also thanks for the new file version!
Gesendet:ÂDienstag, 12. Januar 2016 um 10:48 Uhr
Von:Â"Corinna Vinschen" <email@example.com>
Betreff:ÂRe: cygmagic-1.dll - access violation by accessing the lib via python
On Jan 11 22:31, Holger Bast wrote:
> Hi there,
> I'm using a python wrapper (python-magic,
> https://github.com/ahupp/python-magic) checking some filetypes in a
> small script. The wrapper works fine under Unix-like system, but I got
> an access violation error under cygwin. I already tried an older
> version of file including libmagic from the gnuwin32-project and this
> one works fine - aside it's completely outdated ;)
> This issue was already identified on the issue tracker of the
> python-wrapper but I don't think that this error is a problem of the
> wrapper (see https://github.com/ahupp/python-magic/issues/76[https://github.com/ahupp/python-magic/issues/76]). I
> found some python wrappers on the cygwin mirrors
> (python-magic-5.24-1.tar.xz) but these also produce the same error.
This sounds weird. Are you using Cygwin's python or some native Windows
python? In the latter case, you can't use Cygwin DLLs from your
non-Cygwin python. It won't work as desired and it's not supported.
As for your Cygwin installation, we need the output of `cygcheck -svr'
> Ok, here the script I used:
> requirements: python 2.7 and python-magic
> import magic
> mage = magic.Magic(mime=True)
> filetype = mage.from_file("testfile.odt")
> print filetype
I'm python illiterate but as Cygwin file maintainer I tried this myself.
The packages file-5.24-1, file-devel-5.24-1, python-magic-5.24-1, and
python-2.7.10-1 are installed.
In my case:
$ python2.7 magic.py
Traceback (most recent call last):
File "magic.py", line 1, in <module>
File "/home/corinna/magic.py", line 3, in <module>
mage = magic.Magic(mime=True)
AttributeError: 'module' object has no attribute 'Magic'
What am I doing wrong?
Anyway, I uploaded the latest file 5.25 a few minutes ago.
Corinna Vinschen Please, send mails regarding Cygwin to
Cygwin Maintainer cygwin AT cygwin DOT com
Problem reports: http://cygwin.com/problems.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple