<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Script node error... in Maya Programming Forum</title>
    <link>https://forums.autodesk.com/t5/maya-programming-forum/script-node-error/m-p/5881143#M13644</link>
    <description>&lt;P&gt;Hey guys, I am having some trouble with a script node and expression combination and I cant figure out what is wrong. I have two different script nodes for the test. They both do the same thing, one in python and one in mel. They are both set to execute on open, basically creating a function I can call.&lt;/P&gt;
&lt;P&gt;As a note, in both expressions I have&lt;/P&gt;
&lt;PRE&gt;locator1.translateY = pythonSphere.testEnum;&lt;/PRE&gt;
&lt;P&gt;The expression wouldnt update correctly it seemed if I didnt have it directly connected to some other objects attribute.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;the python one:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;def printEnum(theObject):
	switchTo = cmds.getAttr(theObject+'.testEnum', asString = True)
	print switchTo&lt;/PRE&gt;
&lt;P&gt;the python expression:&lt;/P&gt;
&lt;PRE&gt;locator1.translateY = pythonSphere.testEnum;
python("printEnum('pythonSphere')");&lt;/PRE&gt;
&lt;P&gt;If I change the enum attr I get an error.&lt;/P&gt;
&lt;PRE&gt;#   File "&amp;lt;maya console&amp;gt;", line 2, in printEnum
# TypeError: Flag 'asString' must be passed a boolean argument // &lt;/PRE&gt;
&lt;P&gt;However if I just run the function like this.&lt;/P&gt;
&lt;P&gt;printEnum('pythonSphere')&lt;/P&gt;
&lt;P&gt;it prints the enum as expected, so the function actually works. It only seems to not work if I try to call the function from the expresssion because if I run it exactly as it is thru a mel tab like so&lt;/P&gt;
&lt;PRE&gt;python("printEnum('pythonSphere')");&lt;/PRE&gt;
&lt;P&gt;It STILL works!! It just doesnt work if that is called from an expression and errors out the funciton.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;the mel one:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;global proc printEnumMel(string $theObject){&lt;BR /&gt;string $testFor = $theObject+".testEnum";&lt;BR /&gt;string $spaceSwitcher = `getAttr -asString $testFor`;&lt;BR /&gt;print $spaceSwitcher;}&lt;/PRE&gt;
&lt;P&gt;the mel expression:&lt;/P&gt;
&lt;PRE&gt;locator1.translateX = melSphere.testEnum;
printEnumMel "melSphere";&lt;/PRE&gt;
&lt;P&gt;The mel one works as expected. If you change the enum attr it prints what the enum is set to.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any ideas what is going on? Is this a bug?&lt;/P&gt;
&lt;P&gt;I know extressions are not really mel, but I feel if I can run the function it is trying to run it should still work.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;The file is attached here. You should be able to just load the scene and change the attrs on the spheres and see what is going on.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 15 Dec 2015 01:46:59 GMT</pubDate>
    <dc:creator>ShreddinPB</dc:creator>
    <dc:date>2015-12-15T01:46:59Z</dc:date>
    <item>
      <title>Script node error...</title>
      <link>https://forums.autodesk.com/t5/maya-programming-forum/script-node-error/m-p/5881143#M13644</link>
      <description>&lt;P&gt;Hey guys, I am having some trouble with a script node and expression combination and I cant figure out what is wrong. I have two different script nodes for the test. They both do the same thing, one in python and one in mel. They are both set to execute on open, basically creating a function I can call.&lt;/P&gt;
&lt;P&gt;As a note, in both expressions I have&lt;/P&gt;
&lt;PRE&gt;locator1.translateY = pythonSphere.testEnum;&lt;/PRE&gt;
&lt;P&gt;The expression wouldnt update correctly it seemed if I didnt have it directly connected to some other objects attribute.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;the python one:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;def printEnum(theObject):
	switchTo = cmds.getAttr(theObject+'.testEnum', asString = True)
	print switchTo&lt;/PRE&gt;
&lt;P&gt;the python expression:&lt;/P&gt;
&lt;PRE&gt;locator1.translateY = pythonSphere.testEnum;
python("printEnum('pythonSphere')");&lt;/PRE&gt;
&lt;P&gt;If I change the enum attr I get an error.&lt;/P&gt;
&lt;PRE&gt;#   File "&amp;lt;maya console&amp;gt;", line 2, in printEnum
# TypeError: Flag 'asString' must be passed a boolean argument // &lt;/PRE&gt;
&lt;P&gt;However if I just run the function like this.&lt;/P&gt;
&lt;P&gt;printEnum('pythonSphere')&lt;/P&gt;
&lt;P&gt;it prints the enum as expected, so the function actually works. It only seems to not work if I try to call the function from the expresssion because if I run it exactly as it is thru a mel tab like so&lt;/P&gt;
&lt;PRE&gt;python("printEnum('pythonSphere')");&lt;/PRE&gt;
&lt;P&gt;It STILL works!! It just doesnt work if that is called from an expression and errors out the funciton.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;the mel one:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;global proc printEnumMel(string $theObject){&lt;BR /&gt;string $testFor = $theObject+".testEnum";&lt;BR /&gt;string $spaceSwitcher = `getAttr -asString $testFor`;&lt;BR /&gt;print $spaceSwitcher;}&lt;/PRE&gt;
&lt;P&gt;the mel expression:&lt;/P&gt;
&lt;PRE&gt;locator1.translateX = melSphere.testEnum;
printEnumMel "melSphere";&lt;/PRE&gt;
&lt;P&gt;The mel one works as expected. If you change the enum attr it prints what the enum is set to.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any ideas what is going on? Is this a bug?&lt;/P&gt;
&lt;P&gt;I know extressions are not really mel, but I feel if I can run the function it is trying to run it should still work.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;The file is attached here. You should be able to just load the scene and change the attrs on the spheres and see what is going on.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 15 Dec 2015 01:46:59 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-programming-forum/script-node-error/m-p/5881143#M13644</guid>
      <dc:creator>ShreddinPB</dc:creator>
      <dc:date>2015-12-15T01:46:59Z</dc:date>
    </item>
    <item>
      <title>Re: script node error.</title>
      <link>https://forums.autodesk.com/t5/maya-programming-forum/script-node-error/m-p/5883327#M13645</link>
      <description>&lt;P&gt;Hi ShreddinPB,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I've tested your scene. It looks like a bug. Using DG instead of parallel or serial evaluation would be better(almost no error).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I&amp;nbsp;have logged this as defect in our system.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Yours,&lt;/P&gt;
&lt;P&gt;Li&lt;/P&gt;</description>
      <pubDate>Thu, 29 Oct 2015 08:00:23 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-programming-forum/script-node-error/m-p/5883327#M13645</guid>
      <dc:creator>cheng_xi_li</dc:creator>
      <dc:date>2015-10-29T08:00:23Z</dc:date>
    </item>
    <item>
      <title>Re: script node error.</title>
      <link>https://forums.autodesk.com/t5/maya-programming-forum/script-node-error/m-p/5884280#M13646</link>
      <description>Where do I go to set that setting? I dont see it on the script nodes or in the expression editor.&lt;BR /&gt;thanks!</description>
      <pubDate>Thu, 29 Oct 2015 17:10:24 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-programming-forum/script-node-error/m-p/5884280#M13646</guid>
      <dc:creator>ShreddinPB</dc:creator>
      <dc:date>2015-10-29T17:10:24Z</dc:date>
    </item>
    <item>
      <title>Re: script node error.</title>
      <link>https://forums.autodesk.com/t5/maya-programming-forum/script-node-error/m-p/5885299#M13647</link>
      <description>&lt;P&gt;It is in the preference settings.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;IMG src="https://forums.autodesk.com/t5/image/serverpage/image-id/197485i371D82ED1F927696/image-size/original?v=mpbl-1&amp;amp;px=-1" border="0" alt="EvaluationMode.png" title="EvaluationMode.png" /&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 30 Oct 2015 09:02:42 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-programming-forum/script-node-error/m-p/5885299#M13647</guid>
      <dc:creator>cheng_xi_li</dc:creator>
      <dc:date>2015-10-30T09:02:42Z</dc:date>
    </item>
    <item>
      <title>Re: Script node error...</title>
      <link>https://forums.autodesk.com/t5/maya-programming-forum/script-node-error/m-p/11066095#M13648</link>
      <description>&lt;P&gt;Hey, this looks like it is still a problem.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you create a polyCube&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;from maya import cmds
cmds.polyCube()&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then run the code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;script_node = cmds.scriptNode(
    name="test_scriptNode",
    scriptType=7,  # Time changed.
    beforeScript="cmds.select('pCube1.f[0]')",
    sourceType="python",
    ignoreReferenceEdits=True,
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In DG it works as expected but in Parallel it errors:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;# ValueError: No object matches name: pCube1.f[0] # &lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Doesn't matter if it's written in mel or python.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 28 Mar 2022 16:37:32 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-programming-forum/script-node-error/m-p/11066095#M13648</guid>
      <dc:creator>gavinthomas89</dc:creator>
      <dc:date>2022-03-28T16:37:32Z</dc:date>
    </item>
    <item>
      <title>Re: Script node error...</title>
      <link>https://forums.autodesk.com/t5/maya-programming-forum/script-node-error/m-p/11072656#M13649</link>
      <description>&lt;P&gt;I wonder if putting a "refresh" after the cube creation would help&lt;/P&gt;</description>
      <pubDate>Thu, 31 Mar 2022 03:07:51 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-programming-forum/script-node-error/m-p/11072656#M13649</guid>
      <dc:creator>mcw0</dc:creator>
      <dc:date>2022-03-31T03:07:51Z</dc:date>
    </item>
    <item>
      <title>Re: Script node error...</title>
      <link>https://forums.autodesk.com/t5/maya-programming-forum/script-node-error/m-p/11092152#M13650</link>
      <description>The cube was created in the scene without a script. So refresh doesn't&lt;BR /&gt;achieve anything.&lt;BR /&gt;</description>
      <pubDate>Fri, 08 Apr 2022 04:33:03 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-programming-forum/script-node-error/m-p/11092152#M13650</guid>
      <dc:creator>gavinthomas89</dc:creator>
      <dc:date>2022-04-08T04:33:03Z</dc:date>
    </item>
  </channel>
</rss>

