繁体   English   中英

使用musixmatch python包装器时出错

[英]Error when using musixmatch python wrapper

我一直在尝试使用musixmatch python包装器,但是在尝试运行示例时遇到一个奇怪的错误。 有人可以告诉我如何修复图书馆吗?

$ 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

正如@jdi 在此问题中所解释的,它是一个元类冲突:Python不知道从哪个类派生XMLResponseMessage。 (不能同时来自两个可能的钻石继承)

有一个活动状态食谱可以自动解决此问题(noconflict模块): http : //code.activestate.com/recipes/204197-solving-the-metaclass-conflict/ 缺点是您必须深入研究lib代码并对其进行修改以解决冲突。

从我所看到的,这个库是为开发人员目的量身定制的,只能在他的环境下运行:python 2.7(元类冲突)和python 3.3(无法安装egg模块)都无法安装和测试模块。 我建议您分叉代码,并使其适应您的需求。

暂无
暂无

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

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