tags:

views:

132

answers:

2

Somehow, this works fine in the Maya/Python script editor, but fails when it's inside of my module code. Anyone have any ideas?

class ControlShape(object):
    def __init__(self, *args, **kwargs):
        print 'Inside ControlShape...'

class Cross(ControlShape):
    def __init__(self, *args, **kwargs):
        print 'Entering Cross...'
        super(Cross, self).__init__(*args, **kwargs)
        print 'Leaving Cross...'

x = Cross()

This gives me a TypeError: super(type, obj): obj must be an instance or subtype of type.

A: 

It is good rule of thumb if you're using the super(Class, self)._init_ that you ALWAYS call it this way. This applies to your classes that inherit from object.

class ControlShape(object):
   def __init__(self, *args, **kwargs):
      super(ControlShape, self).__init__()
      print 'Inside ControlShape...'

See if that fixes your error. Just a guess as I don't use maya, but worth a shot.

manifest
A: 

Turns out it had something to do with my imports at the top of the module. I forget which one it was, though. I should have posted this the moment I discovered what it was.

sfjedi