[Sidefx-houdini-list] Custom Expression's calling external language (python/perl)

Rob Pieké pieke at coredp.com
Thu Oct 13 11:23:26 EDT 2005


Hey Rick ... try this custom expression:

string myFunc( string source )
{
     return system( "python test.py " + source );
}

You don't want to use `, since you're already in an expression.

Then, using
-> echo `myFunc( "hello world" )`
should work.

Cheers!


>> Sorry, the stuff inside () should be quoted. I meant to type:
>> -> echo `system( "python myScript.py myArgs" )`
>>
>>> Will this work?
>>> -> echo `system( python myScript.py myArgs )`
> 
> 
> 
> uhmn that surely does work great in the textport. How would I go about 
> intergrating that into a custom expression?
> 
> For example:
> I have a python script that is set to return the incoming 
> string(sys.argv[1].)
> 
> 
> In houdini I write a custom expression:
> -----------------------------------
> string myFunc(string source;)
>     string outstr = "";
>     outstr = `system("python test.py"  + source )`;
>     return(outstr);
> -----------------------------------
> If I echo this in the textport:
> -> echo `myFunc("hello world")`
> 
> This will print return nothing in textport.
> 
> 




More information about the Sidefx-houdini-list mailing list