LumaPictures / pymel

Python in Maya Done Right
Other
490 stars 131 forks source link

fix __import__ using level -1 which is not accepted in Python 3 #445

Open bohdon opened 3 years ago

bohdon commented 3 years ago

Looks like there were some wrapper function __import__ calls still using the no-longer-supported level -1. This fix updates the level to 0.

For reference, the command I was using that caused an error originally was pm.getPanel(underPointer=True) in Maya 2022.1

JPTUNA commented 1 year ago

We have an issue with one of our plug-ins where a ValueError: level must be >=0 is raised, using pymel 1.4.0.

In the standard initializePlugin call for a maya plug-in, we call: pm.callbacks(addCallback=loadAETemplateCallback, hook='AETemplateCustomContent', owner=kPluginNodeName)

the callback:

def loadAETemplateCallback(nodeName):
    AEinstanceAlongCurveLocatorTemplate(nodeName)

the class: class AEinstanceAlongCurveLocatorTemplate(pm.ui.AETemplate): ...

It looks like it is coming from the inherited AETemplate, which when instantiated leads to AELoader calling load, which is fixed by the core/uiTypes.py change in this PR.

Another fix was merged for the internal/factories.py #447 , but the uiTypes.py fix in here has been ignored.

efleurant commented 1 year ago

We have an issue with one of our plug-ins where a ValueError: level must be >=0 is raised, using pymel 1.4.0.

In the standard initializePlugin call for a maya plug-in, we call: pm.callbacks(addCallback=loadAETemplateCallback, hook='AETemplateCustomContent', owner=kPluginNodeName)

the callback:

def loadAETemplateCallback(nodeName):
    AEinstanceAlongCurveLocatorTemplate(nodeName)

the class: class AEinstanceAlongCurveLocatorTemplate(pm.ui.AETemplate): ...

It looks like it is coming from the inherited AETemplate, which when instantiated leads to AELoader calling load, which is fixed by the core/uiTypes.py change in this PR.

Another fix was merged for the internal/factories.py #447 , but the uiTypes.py fix in here has been ignored.

I'd like to second that. Is it possible to push the missing change in uiTypes.py from #447 ? Or do we need to create another pull request?

Thanks in advance