1
votes

I am working with sphinx 1.8 document generation for my project in python 2.7. I have a class inheriting three classes:

class Meta(type(QtGui.QWidget), type(BaseClass)):
    pass

class UI(QWidget, BaseClass, BaseWidget)
    __metaclass__ = Meta

    def __init__(self):
        QtGui.QWidget.__init__(self)
        BaseClass.__init__(self)
        BaseWidget.__init__(self)

There is no error in Python application.

But with sphinx 1.8, the following error is generated: TypeError: metaclass conflict: the metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases.

Could anyone please help with this?

1

1 Answers

0
votes

The problem was with Sphinx using Python 3 instead of Python 2.7. I have the other project running in Python 3. To solve the error force Sphinx to use Python 2.7 version. In make.bat file : remove if statement and set the SPHINXBUILD path explicitly:

@ECHO OFF

pushd %~dp0

REM Command file for Sphinx documentation

set SPHINXBUILD= "C:\\Python27\\Scripts\\sphinx-build.exe"

set SOURCEDIR=.
set BUILDDIR=_build

It will not give the metaclass erro anymore.