[Sidefx-houdini-list] Python expression in a group sop

Simon Barrick simon at primalpictures.com
Wed Apr 22 08:58:16 EDT 2009


Ok so I've made a python function in the otl but I still basically have
the same problem, when I use it in the group sop it doesn't actually
evalute it just uses the code as the group name. 

So this

hou.pwd().parent().hdaModule().namefromfilepath()

Becomes my group name as

Hou_pwd__parent___hdaModule__namefromfilepath__

Is there an equivalent to backticks used in hscript for python
expressions that force them to evaluate?



-----Original Message-----
From: sidefx-houdini-list-bounces at sidefx.com
[mailto:sidefx-houdini-list-bounces at sidefx.com] On Behalf Of Mark Elendt
Sent: 22 April 2009 12:37
To: sidefx-houdini-list at sidefx.com
Subject: Re: [Sidefx-houdini-list] Python expression in a group sop

On Wednesday Apr 22 at 12:30, Simon Barrick wrote:
>  Does anyone know how to get python expressions to evaluate in a group

> sop?
> 
> I have this expression that pulls a name from a path
> 
> os.path.split(hou.pwd().parent().parm('file').eval())[1].split('.')[0]
> 
> But when I stick it in the Group Name field it won't actually
evaluate.
> 
> Also, I'm having to use os.path which may not be available without 
> importing 'os' so is there a hou way of doing this?

You might try something like:

    pythonexprs("__import__('os').path.split(...)")

Though that might be insanely expensive.

It might be better to create a python function which builds the pattern
string for you.

--
Mark Elendt

_______________________________________________
Sidefx-houdini-list mailing list
Sidefx-houdini-list at sidefx.com
https://lists.sidefx.com:443/mailman/listinfo/sidefx-houdini-list

______________________________________________________________________
This communication is from Primal Pictures Ltd., a company registered in England and Wales with registration No. 02622298 and registered office: 4th Floor, Tennyson House, 159-165 Great Portland Street, London, W1W 5PA, UK. VAT registration No. 648874577.

This e-mail is confidential and may be privileged. It may be read, copied and used only by the intended recipient. If you have received it in error, please contact the sender immediately by return e-mail or by telephoning +44(0)20 7637 1010. Please then delete the e-mail and do not disclose its contents to any person.
This email has been scanned for Primal Pictures by the MessageLabs Email Security System.
______________________________________________________________________



More information about the Sidefx-houdini-list mailing list