Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cython relative import error #3003

sploving opened this issue Jun 18, 2019 · 0 comments


None yet
1 participant
Copy link

commented Jun 18, 2019

There is a in the pkg package. The has a Base class , a Test class and Test2 class.
The contents of the is as the following:

class Base(object):

class Test(Base):

def __init__(self):

    super(Test, self).__init__()

    print 'test'

class Test2(Base):

def __init__(self):

    super(Test2, self).__init__()

Then I test it using as the following:


import sys

from pkg.example import Test

sys.path.insert(0, './pkg/')

from example import Test2


The files structure is as the following:





When I use Cython to generate an from, and run, it

reports the following error:

Traceback (most recent call last):

File "", line 5, in


File "pkg/", line 6, in pkg.example.Test.init

TypeError: super(type, obj): obj must be an instance or subtype of type

Any suggestion? Thanks.

Python version is 2.7, Cython Version is 0.29.10

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.