[Sidefx-houdini-list] call opparm from outside houdini

Ammon Riley ammon.riley at gmail.com
Tue May 1 12:25:50 EDT 2007

> I'm referring to python script. Is there a reason why I should promote
> "opparm -c %s cache_execute\n" % object instead of strings operations?

No -- it's just a question of personal taste. I find the former more
readable than sprinkling plus signs and quotes in the code:

    command = "opparm -c %s %s" % (node, param)


    command = "opparm -c" + node + " " + param + "\n"

I find perl's string interpolation even more readable:

    $command = "opparm -c $node $param";

but to get something similar in python (I think), you have to go
with the Template class:


> This is the current script (not working):
> command = "opparm -c "+node+" "+param+"\n"
> phpscript = os.popen("hscript ........../filename.hip","w")
> phpscript.write(command)

Well, without seeing complete code, the only thing I can suggest is to
see if the command is being built okay:

    command = "opparm -c "+node+" "+param+"\n"
    print command

If the command that gets printed is what you expect, then the problem
is somewhere in the pipe. Maybe the popen failed?

You should be more explicit about "not working". That's pretty vague,
and there could be a lot of reasons why something "isn't working". If
there is an error message, what is it? Can you distill the problem down
into a short, self-contained snippet of code that exhibits the same
behaviour? What's it doing that you're not expecting, or, conversely,
what's it *not* doing that you're expecting it should?


More information about the Sidefx-houdini-list mailing list