简体   繁体   English

使用musixmatch python包装器时出错

[英]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 . 我一直在尝试使用musixmatch python包装器,但是在尝试运行示例时遇到一个奇怪的错误。 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. 正如@jdi 在此问题中所解释的,它是一个元类冲突:Python不知道从哪个类派生XMLResponseMessage。 ( 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/ . 有一个活动状态食谱可以自动解决此问题(noconflict模块): 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. 缺点是您必须深入研究lib代码并对其进行修改以解决冲突。

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. 从我所看到的,这个库是为开发人员目的量身定制的,只能在他的环境下运行:python 2.7(元类冲突)和python 3.3(无法安装egg模块)都无法安装和测试模块。 I would advise you to fork the code, and adapt it to your needs. 我建议您分叉代码,并使其适应您的需求。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 运行时错误:在python中使用包装器时,MATLAB位置未知 - Runtime Error: Unknown MATLAB location when using a wrapper in python 使用MediaInfo加上包装器的Python错误 - Python error using MediaInfo plus wrapper 如何解析musixmatch python api JSON响应? - How to parse musixmatch python api JSON response? 在远程 python 3 解释器周围使用包装器时,如何在 Pycharm 中禁用 python 2.7 代码兼容性错误消息? - How can I disable python 2.7 code compatibility error message in Pycharm when using wrapper around remote python 3 interpreter? 使用Python包装器安装libfreenect时CMake错误 - CMake Error When Installing libfreenect w/ Python Wrapper BadParametersError:使用OVH Python包装器时签名无效 - BadParametersError: Invalid signature when using OVH Python wrapper 通过 NextCloud api 的 Python 包装器将文件上传到 Nextcloud 时出错 - Error when uploading files to the Nextcloud via Python wrapper for NextCloud api 在gspread包装器中使用unicode函数时出错。 潜在和错误 - Error when using unicode function in the gspread wrapper. Potentially and bug 'DataFrame' object 在使用装饰器包装器进行运行时是不可调用错误 - 'DataFrame' object is not callable error when using Decorator wrapper for run time Python-从musixmatch json响应中获取歌词 - Python - Getting lyrics back from musixmatch json response
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM