delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2016/01/12/09:01:56

X-Recipient: archive-cygwin AT delorie DOT com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:mime-version:message-id:from:to:subject
:content-type:date:in-reply-to:references
:content-transfer-encoding; q=dns; s=default; b=LncHEMNNk8Bg+AXj
CFYr6sDHqF3lAwAFJnK8Fa6kofsVc45lgB39J8QWy70EPEY3KEztvGQflyUY73L5
bG1QGa8F8h0rQtyUjJIM5tFwkuoGYVx2GvcK0dAlNnoDdkSIHk3Q+O6ZcD02SlxX
zApzZJ6EQicg6Dx/yIsmLlwa3Es=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:mime-version:message-id:from:to:subject
:content-type:date:in-reply-to:references
:content-transfer-encoding; s=default; bh=N37c/fKZEYOjlwhFzVowil
BMMyM=; b=P3Vbxn44QEZIytBoQ4WZjKDmYcnoj4s8Ku4RLkzpJDsPucu0cB27nk
g285xFTR1n6sLqHiWGMMOH/l1G+rZgMOZ+9/Nma/ggwzUtDn1mZLYfB+HvctVWQx
5mryefZCRxL71jmWbOzZEqJVshRNNF6Jx37RNewnaynGmOVDpXvM4=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: No, score=0.8 required=5.0 tests=BAYES_60,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=no version=3.3.2 spammy=violation, Magic, HImportance:normal, shipped
X-HELO: mout.gmx.net
MIME-Version: 1.0
Message-ID: <trinity-6e96cad0-af2f-4c2e-920f-0be1dbbd2de7-1452607283910@3capp-gmx-bs68>
From: "Holger Bast" <HolgerBast AT gmx DOT de>
To: cygwin AT cygwin DOT com
Subject: Re: Re: cygmagic-1.dll - access violation by accessing the lib via python
Date: Tue, 12 Jan 2016 15:01:23 +0100
Sensitivity: Normal
In-Reply-To: <20160112094843.GB15034@calimero.vinschen.de>
References: <trinity-ec69c9bb-c7c8-4910-b745-c0aa14a3874a-1452547860856 AT 3capp-gmx-bs63>, <20160112094843 DOT GB15034 AT calimero DOT vinschen DOT de>
X-UI-Message-Type: mail
X-UI-Out-Filterresults: notjunk:1;V01:K0:WP6813N5rPQ=:LgXgsqRkMQolMbdqiufS91 vHVq5bmFwMu2VGMI1/vfpRvXyt3Lx88jvC1Ja4CyFrRqXIA2iC7uEFVlAvJK9k+jKIf7JGojm vrVc5elSoAak4VEA2+3APGbnFrao+iUPilro/MYOT3gFxaMT/LN77sOV2vy/hPP5OhI13h7rb rQUte23fhBo5aV0qTnXmM3bwvQ1jMSPOHPgI4f5/ZmuAve26Z2LFohPFD8zGGskOnbkZ+8okE ajIKFHuVFWDfTRPJ3ecVDnmtX0YQTAHaceTIAnP80Gy+n2tD9LO5nkWUjKsXS5Qqx35k+o0pa CIICX3b5ixrmG+VtuquOKWTcD5i1kVszD4b9bv2tUmuf3vQIMH9cmYXe+FIf5EZwQSJYXAcFz It0GCqbYVNj1mfhtUNfZ/WItqltUiozLNZYxDc4ntSB1vsTK/DCiGh0LlZ7iz0zN/UY6DRAmz k+siakKw6w==
X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id u0CE1q2G008011

Hey Corinna,
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.)
see https://pip.pypa.io/en/stable/installing/
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!
Bye, Holger
 

Gesendet: Dienstag, 12. Januar 2016 um 10:48 Uhr
Von: "Corinna Vinschen" <corinna-cygwin AT cygwin DOT com>
An: cygwin AT cygwin DOT com
Betreff: Re: cygmagic-1.dll - access violation by accessing the lib via python
Hi Holger,

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'
per http://cygwin.com/problems.html[http://cygwin.com/problems.html]

> 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.

> Output:

In my case:

$ python2.7 magic.py
Traceback (most recent call last):
File "magic.py", line 1, in <module>
import magic
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

--
Corinna Vinschen Please, send mails regarding Cygwin to
Cygwin Maintainer cygwin AT cygwin DOT com
Red Hat

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019