python script error

   5063   7   0
User Avatar
Member
303 posts
Joined: May 2007
Offline
maybe a fool question,but i really need your help.
i want delete groups by $F like this in hscript:
if($F>10,group_1,group_2)

if i use python in “delete” node's “group” parater like this:


frame=hou.frame()
if frame<=21:
return group_1 group_2 group_3
else:
return group_4 group_5 group_6


there is an error
Error evaluating autocompletion:
“ File \”<stdin>\“, line 1
__import__('houdiniInterpreter').getAutoCompleteMethodsList('frame=25
^
SyntaxError: EOL while scanning single-quoted string
https://vimeo.com/user3971456/videos [vimeo.com]
User Avatar
Member
1908 posts
Joined: Nov. 2006
Offline
That error pops up every once in a while but it has to do with popup help tips and can really be ignored. The only problem I see with your code is you don't have your group names as a string. You are technically trying to return 3 python objects that I'm pretty sure don't exist, and in an illegal manner if they do.

if hou.frame() < 21:
return “group_1 group_2 group_3”
else:
return “group_4 group_5 group_6”
Edited by - May 28, 2010 09:53:37
Graham Thompson, Technical Artist @ Rockstar Games
User Avatar
Member
303 posts
Joined: May 2007
Offline
thank you
i fond the problem is,the “group” parmeter does not support expression like this : if($F>10,group1,group2) or this `if($F>10,group1,group2)`,what a bad news!!
https://vimeo.com/user3971456/videos [vimeo.com]
User Avatar
Member
8591 posts
Joined: July 2007
Offline
it surely supports, but
you need to use ifs() if you want to return string
like this
`ifs($F>10,“group1”,“group2”)`

(i am not sure if you are forgetting string quotes “” deliberately or your group1, group2… are variables, but if they are strings, don't forget quotes)
Tomas Slancik
FX Supervisor
Method Studios, NY
User Avatar
Member
303 posts
Joined: May 2007
Offline
thank you very much!!
it works
ifs !!

wish python work too
https://vimeo.com/user3971456/videos [vimeo.com]
User Avatar
Member
201 posts
Joined: July 2005
Offline
Python does work. As Graham mentioned, you need to return with the groups quoted. In addition, you need to make sure the group parameter is turned into a python expression (the field becomes reddish magenta colour).
Cheers,
Rob
Digital Supervisor | Stargate Studios Toronto
User Avatar
Member
1908 posts
Joined: Nov. 2006
Offline
Here's a file with Python working just fine. Exactly the same as the code I posted above.

Attachments:
python_delete_groups.hip (51.3 KB)

Graham Thompson, Technical Artist @ Rockstar Games
User Avatar
Member
303 posts
Joined: May 2007
Offline
oh sorry it does works
thank you very much
https://vimeo.com/user3971456/videos [vimeo.com]
  • Quick Links