-
Notifications
You must be signed in to change notification settings - Fork 109
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix for Python Magic API change #157
Fix for Python Magic API change #157
Conversation
To ensure subsequent fixes will work.
Following the changes here: ahupp/python-magic@b166698
Current release version of html5lib (1.0b10) needs a newer setuptools version than the one Travis provides. Error is: html5lib requires setuptools version 18.5 or above Travis attempts to install html5lib as prompted by setup.py, which then installs the current version, which has this problem.
This also fixes the Travis tests, which is a separate html5lib issue (a change which can be revoked when they update PyPI, I think the fix is already merged on their GitHub). Can separate this out into another PR if you prefer, though it meant I could demonstrate tests passing on this PR. |
I get lots of errors like this, in Python 2 or 3, when running nosetests on this branch.
|
@frabcus Weird. That looks like any.py can't see magic's Do you get the same issue running nosetests on master locally, or just on my branch? Also worth checking if python -c "from __future__ import print_function; import magic; print(magic.from_buffer)" gives you an error. |
@frabcus: long shot, you don't by any chance have filemagic installed and it's shadowing python-magic? ( It uses the same module name, magic. When I installed this in my virtualenv containing python-magic, I got the AttributeError as above. After uninstalling filemagic, accessing |
The output of Looks like: ['MAGIC_CHECK', 'MAGIC_COMPRESS', 'MAGIC_CONTINUE', 'MAGIC_DEBUG', 'MAGIC_DEVICES', 'MAGIC_ERROR', 'MAGIC_MIME', 'MAGIC_MIME_ENCODING', 'MAGIC_NONE', 'MAGIC_NO_CHECK_APPTYPE', 'MAGIC_NO_CHECK_ASCII', 'MAGIC_NO_CHECK_COMPRESS', 'MAGIC_NO_CHECK_ELF', 'MAGIC_NO_CHECK_FORTRAN', 'MAGIC_NO_CHECK_SOFT', 'MAGIC_NO_CHECK_TAR', 'MAGIC_NO_CHECK_TOKENS', 'MAGIC_NO_CHECK_TROFF', 'MAGIC_PRESERVE_ATIME', 'MAGIC_RAW', 'MAGIC_SYMLINK', 'Magic', 'MagicException', '__builtins__', '__doc__', '__file__', '__name__', '__package__', '_get_magic_type', '_instances', '_magic_buffer', '_magic_file', '_magic_load', 'c_char_p', 'c_int', 'c_size_t', 'c_void_p', 'coerce_filename', 'ctypes', 'dll', 'errorcheck_negative_one', 'errorcheck_null', 'from_buffer', 'from_file', 'glob', 'libmagic', 'magic_buffer', 'magic_check', 'magic_close', 'magic_compile', 'magic_errno', 'magic_error', 'magic_file', 'magic_load', 'magic_open', 'magic_setflags', 'magic_t', 'maybe_decode', 'os', 'sys', 'threading'] for me with python-magic==0.4.12. |
Install older version of python-magic which is compatible with messytables. messytables just installs the latest >=0.4.6 but the latest version isn't compatible with messytables right now. See okfn/messytables#157 for more details. This can be removed when the PR is merged, and a new version of messytables containing it is released on PyPI.
Turned out the problem was my global (installed via an Ubuntu package) version of nosetests getting found before the one in my virtualenv. Fine now and merging. |
Resolves issues with python-magic that prevented a fresh install from working on Python 3. See okfn/messytables#157
Resolves issues with python-magic that prevented a fresh install from working on Python 3. See okfn/messytables#157
Here, python-magic changed the behaviour of
from_buffer()
.This breaks a new install of messytables on Python 3.4, shown by tests failing:
The alternative fix would be to pin python-magic at some version <0.4.12.