pymel.core.nodetypes.Locator class giving a ValueError when instantiated

27 views
Skip to first unread message

bloodty...@gmail.com

unread,
Nov 2, 2018, 7:03:14 PM11/2/18
to Python Programming for Autodesk Maya
I can't seem to find anything about this particular problem on the web.
Basically, If I create a locator in any other way or if I instantiate any other pymel.core.nodetype.* class ( I haven't tried them all obviously ) I incur in no unexpected behavior.
If I, instead, try to create an instance of the pymel.core.nodetypes.Locator class, I incur in the following error :


# Error: line 1: ValueError: file C:\Program Files\Autodesk\Maya2017\Python\lib\site-packages\pymel\core\general.py line 2273: unexpect result locator1 returned by spaceLocator #

Looking at general.py this seems to happen in the node creation when the newly created Maya node can't be correctly found or is not of the correct type.
I'm not sure what is the reason behind this error, but, considering that it only happens when I try to instantiate this particular class ( the product of which works perfectly if created in any other way ), I'm thinking this may actually be a bug.

Does anyone know what exactly may be the reason behind this behavior? Am I doing something wrong and this is to be expected ?

Robert White

unread,
Nov 2, 2018, 11:00:09 PM11/2/18
to Python Programming for Autodesk Maya
So what seems to be happening is that pymel.core.general.spaceLocator has been altered to return just a Locator and not a list.
pymel.core.nodetypes.Locator uses pymel.core.general.spaceLocator to generate the object, and then because it isn't a list (which is what the generic pymel machinery expects) it throws that error.

So this is definitely a bug.

Robert White

unread,
Nov 2, 2018, 11:02:28 PM11/2/18
to Python Programming for Autodesk Maya
Also, the secondary check, where it tries to see if the nodetype matches the newly created node also fails, because spaceLocator has created a transform, and the secondary check is looking for a locator.

Robert White

unread,
Nov 2, 2018, 11:26:05 PM11/2/18
to Python Programming for Autodesk Maya
Opened a PR for a fix https://github.com/LumaPictures/pymel/pull/415, may or may not get accepted.
But simple enough if you want to patch it locally.

bloodty...@gmail.com

unread,
Nov 3, 2018, 7:36:22 AM11/3/18
to Python Programming for Autodesk Maya
Thanks a lot for taking the time to check this and notifying the bug.

I will probably try and patch it locally as I will need this functionality working in a few days for the project I'm working on.
Reply all
Reply to author
Forward
0 new messages