简体   繁体   中英

Error when using musixmatch python wrapper

I have been trying to use the the musixmatch python wrapper but I am getting a strange error when trying to run the example . Can anybody tell me what should be done to fix the library?

$ python
Python 2.6.6 (r266:84292, Dec 26 2010, 22:31:48) 
[GCC 4.4.5] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import musixmatch.ws
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "musixmatch/ws.py", line 14, in <module>
    import musixmatch.api
  File "musixmatch/api.py", line 167, in <module>
    class XMLResponseMessage(ResponseMessage, etree.ElementTree):
TypeError: Error when calling the metaclass bases
    metaclass conflict: the metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases

As explained by @jdi in this question , it is a metaclass confict : Python does not know from which class to derive XMLResponseMessage from. ( it can't be from both due two possible diamond inheritance)

There is an Active State Recipe which solves this problem automatically (noconflict module): http://code.activestate.com/recipes/204197-solving-the-metaclass-conflict/ . The drawback is that you have to dive into the lib code and modify it to resolve the conflict.

From what I've seen, this lib was tailored for the developper purpose, and can only be run with his environment : neither python 2.7 (metaclass clash) nor python 3.3 ( unable to install the egg module) are able to install and test the module. I would advise you to fork the code, and adapt it to your needs.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM