Calling function from python source editor
3367 4 0- chenkianwee
- Member
- 64 posts
- Joined: Oct. 2009
- Offline
I stored some functions in the python source editor window however when I try to call the function for an expression, it doesnt work. It is very unstable sometimes i would be able to call the function, sometimes it doesnt. Am i doing something wrong ? cause i thought fucntion in the python source editor can be access from everywhere in houdini, thanks
- graham
- Member
- 1904 posts
- Joined: Nov. 2006
- Offline
- chenkianwee
- Member
- 64 posts
- Joined: Oct. 2009
- Offline
Ya sure, attached is an example file. I can't seem to call the function from python source editor in the group node, pattern parameter. It doesn not response.
Oh there is another issue everytime i try to edit the expression in the group node this error msg pop out
Error evaluating autocompletion:
“ File \”<stdin>\“, line 1
__import__('houdiniInterpreter').getCallTipOrAutoCompleteArgumentsList('grid_i=hou.evalParm(\”/obj/geo1/gridres1\")
^
SyntaxError: EOL while scanning single-quoted string
What seems to be the problem? its not affecting the running of the file but it just always appears.
Thanks alot
Oh there is another issue everytime i try to edit the expression in the group node this error msg pop out
Error evaluating autocompletion:
“ File \”<stdin>\“, line 1
__import__('houdiniInterpreter').getCallTipOrAutoCompleteArgumentsList('grid_i=hou.evalParm(\”/obj/geo1/gridres1\")
^
SyntaxError: EOL while scanning single-quoted string
What seems to be the problem? its not affecting the running of the file but it just always appears.
Thanks alot
- graham
- Member
- 1904 posts
- Joined: Nov. 2006
- Offline
There are several issues here, none of which really have to do with hou.session.
The main problem which is causing the error is that your function inside the session module is trying to use variables that don't exist inside it. You need to pass your grid_* values to the function.
Secondly your function is trying to print a value. This print statement makes the value go to the console. You need to return a value, not print. Also, you can't really just return a python list, you need to return a string of some sort. For example,
The main problem which is causing the error is that your function inside the session module is trying to use variables that don't exist inside it. You need to pass your grid_* values to the function.
Secondly your function is trying to print a value. This print statement makes the value go to the console. You need to return a value, not print. Also, you can't really just return a python list, you need to return a string of some sort. For example,
return "%s, %s, %s" % (i, j, k)
Graham Thompson, Technical Artist @ Rockstar Games
- chenkianwee
- Member
- 64 posts
- Joined: Oct. 2009
- Offline
-
- Quick Links