Giter VIP home page Giter VIP logo

Comments (5)

joulez avatar joulez commented on May 16, 2024

Hi,
What is expected from that attribute if it was working before?
There is however magic.MAGIC_MIME
Jules

from python-magic.

ahupp avatar ahupp commented on May 16, 2024

You probably have a different module named magic in your path. Run python with python -v, then import magic and you should see where it's coming from.

from python-magic.

ahupp avatar ahupp commented on May 16, 2024

Actually, you are seeing the right module (As in the one corresponding to this repo). There is a different module out there called magic that might have a MIME attribute, this one does not. See the instructions for use at the top of the README.md file.

from python-magic.

hellok avatar hellok commented on May 16, 2024

import magic # loaded from Zip /Library/Python/2.7/site-packages/python_magic-0.4.3-py2.7.egg/magic.pyc
magic
module 'magic' from '/Library/Python/2.7/site-packages/python_magic-0.4.3-py2.7.egg/magic.pyc'

magic.open()
Traceback (most recent call last):
File "", line 1, in
AttributeError: 'module' object has no attribute 'open'

magic
module 'magic' from '/Library/Python/2.7/site-packages/python_magic-0.4.3-py2.7.egg/magic.pyc'

magic.from_file
function from_file at 0x10da72e60

sorry

from python-magic.

itoffshore avatar itoffshore commented on May 16, 2024

I had this error too trying to build syslog-summary for Alpine Linux.

The fix was very simple:

--- syslog-summary-1.14/syslog-summary
+++ syslog-summary-1.14/syslog-summary.new
@@ -130,9 +130,8 @@
    """Returns True if the filename is a gzipped compressed file""" 
    try:
        import magic
-       ms = magic.open(magic.MAGIC_NONE)
-       ms.load()
-       if re.search("^gzip compressed data.*", ms.file(filename)):
+       ms = magic.from_file(filename)
+       if re.search("^gzip compressed data.*", ms):
            return True
        else:
            return False

from python-magic.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.