【问题标题】:Error when using musixmatch python wrapper使用 musixmatch python 包装器时出错
【发布时间】:2013-06-17 13:46:39
【问题描述】:

我一直在尝试使用musixmatch python wrapper,但在尝试运行example 时遇到了一个奇怪的错误。谁能告诉我应该怎么做才能修复图书馆?

$ 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

【问题讨论】:

    标签: python rest wrapper python-2.6 musixmatch


    【解决方案1】:

    正如@jdi in this question 所解释的,这是一个元类冲突:Python 不知道从哪个类派生 XMLResponseMessage。 (它不可能来自两个可能的钻石继承)

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

    据我所见,这个库是为开发者目的量身定制的,只能在他的环境中运行:python 2.7(元类冲突)和 python 3.3(无法安装 egg 模块)都无法安装并测试模块。我建议您分叉代码,并根据您的需要进行调整。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-08-01
      • 1970-01-01
      • 2015-12-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-04-11
      相关资源
      最近更新 更多