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.
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.
I had this exact same problem. It's definitely not practical to restart maya each time you make a change. I found an answer here that solved this problem for me.
You should read the linked answer to understand why its only suitable for debugging. But briefly, put this code in userSetup.py, then each time you edit your code run reload_package(my_package)
It has to do with reloading modules. Reloading a module often changes the internal object in memory which makes the isinstance test of super return False.
http://thingspython.wordpress.com/2010/09/27/another-super-wrinkle-raising-typeerror/
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.
See if that fixes your error. Just a guess as I don't use maya, but worth a shot.