diff options
| author | Adam Hupp <adam@hupp.org> | 2010-03-31 16:30:01 -0700 |
|---|---|---|
| committer | Adam Hupp <adam@hupp.org> | 2010-03-31 16:32:12 -0700 |
| commit | 6812c08876463ec47ea86ae0d9e83e17161c32bd (patch) | |
| tree | 7ba4a6464a05ca159da11c9083cbafd9c633be02 | |
| parent | 5608bf2d794936a5e5bb11ac697ceb1969e49888 (diff) | |
| download | python-magic-6812c08876463ec47ea86ae0d9e83e17161c32bd.tar.gz | |
- Grab fix for OSX from bitbucket.org/pfw/
- Produce a more sensible error message when no library is found
| -rw-r--r-- | magic.py | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -105,6 +105,13 @@ def from_buffer(buffer, mime=False): libmagic = ctypes.CDLL(ctypes.util.find_library('magic')) +if not libmagic._name: + import sys + if sys.platform == "darwin": + # try mac ports location + libmagic = ctypes.CDLL('/opt/local/lib/libmagic.dylib') +if not libmagic._name: + raise Exception('failed to find libmagic. Check your installation') magic_t = ctypes.c_void_p |
