[Sidefx-houdini-list] execute external python script

Graham Thompson gthompson at sidefx.com
Wed Dec 5 08:36:39 EST 2007


You can just use the pattern argument to set the filter type.

hou.ui.selectFile(pattern='*.py')

Francois-Xavier Boussard wrote:
> Thanks, many !
>
> Maybe, on day, a filter for the .py files:
> hou.ui.selectFile(file_type=hou.fileType.Py)
>
> thanks
> François
>
>
> Selon Graham Thompson <gthompson at sidefx.com>:
>
>   
>> You can use hou.expandString() on your file path returned by
>> selectFile.  That will allow you to run execfile on it.
>>
>> path = hou.expandString(hou.ui.selectFile())
>>
>>
>> As for setting an Hscript variable as a result of a python command, you
>> could do something like
>>
>> set foo = `pythonexprs('hou.ui.selectFile()')`
>>
>>
>> Houdini 9.0 does not currently have a python equivalent to things such
>> as $script_value so what you are doing is probably
>> the best you can for now.
>>
>>
>> Francois-Xavier Boussard wrote:
>>     
>>> Hello,
>>>
>>> I'm looking after an easy way to run python script from arbitrary
>>>       
>> directories on
>>     
>>> disk. I mean to pick it with a file selector UI.
>>>
>>> Sound simple, i end up with an hscript callback button from an hda... Is it
>>> possible to do that from a shelf ?
>>>
>>> Menu File-> Run Script: only allow hscript, why ?
>>>
>>> A shelf tool with a python script hou.ui.selectFile() return unexpanded
>>>       
>> variable
>>     
>>> as $HOME (linux) that are wrong with execfile(). Is there a way to expand
>>>       
>> those
>>     
>>> variable with the houdini python tools ?
>>>
>>> A shelf tool with an hscript. How do i pass the result of an
>>>       
>> hou.ui.selecFile()
>>     
>>> to an hscript variable ?
>>>   set foo = `run('python -c
>>>       
>> "hou.ui.selectFile(file_type=hou.fileType.Any)"')
>>     
>>>   echo $foo
>>> return blank
>>>
>>> An HDA with a file button and a callback script:
>>> how to access the $script_value from a python script ?
>>> It works with a hscript callback:
>>>   python -c "execfile('${script_value}')"
>>> It is not that nice, using an hda plus hscript...
>>>
>>> Did i miss an obvious way to do it ?
>>>
>>> thanks
>>> francois
>>>
>>>
>>>
>>> _______________________________________________
>>> Sidefx-houdini-list mailing list
>>> Sidefx-houdini-list at sidefx.com
>>> https://lists.sidefx.com:443/mailman/listinfo/sidefx-houdini-list
>>>
>>>       
>> _______________________________________________
>> Sidefx-houdini-list mailing list
>> Sidefx-houdini-list at sidefx.com
>> https://lists.sidefx.com:443/mailman/listinfo/sidefx-houdini-list
>>
>>     
>
>
> _______________________________________________
> Sidefx-houdini-list mailing list
> Sidefx-houdini-list at sidefx.com
> https://lists.sidefx.com:443/mailman/listinfo/sidefx-houdini-list
>   


-- 
Graham Thompson
Character Tool Developer

Side Effects Software
gthompson at sidefx.com
(416) 504-9876 x217




More information about the Sidefx-houdini-list mailing list