diff options
| author | Adam Hupp <adam@hupp.org> | 2012-09-17 10:33:17 -0700 |
|---|---|---|
| committer | Adam Hupp <adam@hupp.org> | 2012-09-17 10:33:17 -0700 |
| commit | 4e9d5cb678deb087e113f2ec27083b2b1d522855 (patch) | |
| tree | ed0f10649068197ba3273be5f4cecc1e2331997e | |
| parent | e9bb69524abf0a957a495570b71c436ae6749d31 (diff) | |
| parent | 6c23fa27c62c1b3dc0da842fb5e06c7d7aecbfe2 (diff) | |
| download | python-magic-4e9d5cb678deb087e113f2ec27083b2b1d522855.tar.gz | |
Merge branch 'master' of github.com:ahupp/python-magic
| -rw-r--r-- | __init__.py | 0 | ||||
| -rw-r--r-- | magic.py | 13 |
2 files changed, 7 insertions, 6 deletions
diff --git a/__init__.py b/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/__init__.py @@ -27,8 +27,8 @@ class MagicException(Exception): pass class Magic: """ - Magic is a wrapper around the libmagic C library. - + Magic is a wrapper around the libmagic C library. + """ def __init__(self, mime=False, magic_file=None, mime_encoding=False): @@ -38,7 +38,7 @@ class Magic: mime - if True, mimetypes are returned instead of textual descriptions mime_encoding - if True, codec is returned magic_file - use a mime database other than the system default - + """ flags = MAGIC_NONE if mime: @@ -65,7 +65,7 @@ class Magic: if not os.path.exists(filename): raise IOError("File does not exist: " + filename) - + return magic_file(self.cookie, filename) def __del__(self): @@ -115,8 +115,9 @@ if dll: if not libmagic or not libmagic._name: import sys - platform_to_lib = {'darwin': ['/opt/local/lib/libmagic.dylib', - '/usr/local/lib/libmagic.dylib'], + platform_to_lib = {'darwin': ['/opt/local/lib/libmagic.dylib', + '/usr/local/lib/libmagic.dylib', + '/usr/local/Cellar/libmagic/5.10/lib/libmagic.dylib'], 'win32': ['magic1.dll']} for dll in platform_to_lib.get(sys.platform, []): try: |
