超级功能在一个maya python模块里面不工作 [英] super function doesn't work inside a maya python module

查看:378
本文介绍了超级功能在一个maya python模块里面不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

不知何故,这在Maya / Python脚本编辑器中工作正常,但是当它在我的模块代码内时失败。任何人都有任何想法?

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()

这给我一个TypeError:super(type,obj):obj必须是一个实例或子类型的类型。

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.

这篇关于超级功能在一个maya python模块里面不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆