Your message dated Wed, 13 Mar 2013 12:08:00 +0100
with message-id <[email protected]>
and subject line Re: python-magic: API is incompatible with 'magic' from pypi
has caused the Debian Bug report #702135,
regarding python-magic: API is incompatible with 'magic' from pypi
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)


-- 
702135: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=702135
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
Package: python-magic
Version: 5.04-5+squeeze2
Severity: wishlist
Tags: upstream

I found the hard way that the API exported by the Python module ‘magic’ differs 
among different versions of the module.

Impact:
A Python script, developed in a Debian Linux installation using the
provided python-magic package, won't work as is when transferred to a
different POSIX system, which uses the python-magic package installed
using the 'pip install python-magic' method.
The Debian package and its documentation should be modified to provide
also an API compatible with the other package.

The version installed when installing the Debian package ‘python-magic’ expects 
the following API:

import magic
mymagic = magic.open(magic.MAGIC_MIME_TYPE)
mymagic.load()
mtype = mymagic.file(inpfname)
print(”The MIME type of the file %s is %s” % (inpfname,mtype))

The version installed using ‘pip install python-magic’ expects the following 
API:

import magic
mymagic = magic.Magic(mime=True)
mtype = mymagic.from_file(inpfname)
print(”The MIME type of the file %s is %s” % (inpfname,mtype))

The following code allows the rest of the script to work the same way with 
either version of ‘magic’:

import magic
def build_magic():
  try:
    mymagic = magic.open(magic.MAGIC_MIME_TYPE)
    mymagic.load()
  except AttributeError,e:
    mymagic = magic.Magic(mime=True)
    mymagic.file = mymagic.from_file
  return(mymagic)
mymagic = build_magic()
mtype = mymagic.file(inpfname)
print(”The MIME type of the file %s is %s” % (inpfname,mtype))

-- System Information:
Debian Release: 6.0.7
  APT prefers stable-updates
  APT policy: (500, 'stable-updates'), (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.32-5-vserver-amd64 (SMP w/8 CPU cores)
Locale: LANG=en_US.utf8, LC_CTYPE=en_US.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages python-magic depends on:
ii  libc6                   2.11.3-4         Embedded GNU C Library: Shared lib
ii  libmagic1               5.04-5+squeeze2  File type determination library us
ii  python                  2.6.6-3+squeeze7 interactive high-level object-orie
ii  python-support          1.0.10           automated rebuilding support for P

python-magic recommends no packages.

Versions of packages python-magic suggests:
pn  python-magic-dbg              <none>     (no description available)

-- no debconf information

--- End Message ---
--- Begin Message ---
it is a different project, so it's different, no suprise there.

-- 
Address:        Daniel Baumann, Donnerbuehlweg 3, CH-3012 Bern
Email:          [email protected]
Internet:       http://people.progress-technologies.net/~daniel.baumann/

--- End Message ---

Reply via email to