I created wx dialog to use with python script I made. It generates folder structure, similar to XSI.
http://screencast.com/t/fbElDlD2HD4 [screencast.com]
I also want to save scene when creating folders so I can use $HIP to organize assets. Problem is that when I use variable, that holds path, as hipFile.save() argument, Houdini crash. Same variable is used to generate directory, and I am just adding scene file name at end of it. Directory path is chosen from Choose folder wx dialog and stored as string, I am adding rest using os.path.join. When I print that variable everything looks OK.
Also when I manually type path, in hipFile.save(), it works. I do add \\ to work, and yeah I am on Windows.
I am almost sure that is has to do with slashes, but I just can not debug it.
BTW is there any tutorial about how to make PyQt to work with Houdini. Example in help just explains that it should be installed in $HFS/python. I did it but Houdini does not ‘see it’.
Python hou.hipFile.save and wx problem
8757 5 1- SreckoM
- Member
- 379 posts
- Joined: 12月 2006
- Offline
- SreckoM
- Member
- 379 posts
- Joined: 12月 2006
- Offline
- SreckoM
- Member
- 379 posts
- Joined: 12月 2006
- Offline
- edward
- Member
- 7714 posts
- Joined: 7月 2005
- Offline
Any file path that you pass into HOM must have backslashes converted to forward slashes.
My guess is also that hou.hipFile.save() doesn't expand environment variables so you should do so first using hou.expandString().
eg. hou.hipFile.save(hou.expandString(path).replace('\\', ‘/’))
Please log a docs bug for PyQT. I think it should be installed in either $HFS/python25 or $HFS/python26 these days.
My guess is also that hou.hipFile.save() doesn't expand environment variables so you should do so first using hou.expandString().
eg. hou.hipFile.save(hou.expandString(path).replace('\\', ‘/’))
Please log a docs bug for PyQT. I think it should be installed in either $HFS/python25 or $HFS/python26 these days.
- edward
- Member
- 7714 posts
- Joined: 7月 2005
- Offline
PS. See also this thread
http://www.sidefx.com/index.php?option=com_forum&Itemid=172&page=viewtopic&t=25363&highlight= [sidefx.com]
http://www.sidefx.com/index.php?option=com_forum&Itemid=172&page=viewtopic&t=25363&highlight= [sidefx.com]
- SreckoM
- Member
- 379 posts
- Joined: 12月 2006
- Offline
Thanks edward.
I figured out that I have to convert to forward slashes. I used .replace for first part of path, one that I am getting from wx DriDialog and rest is added using posixpath module. Scripts works really nice, except it does not store in $HIP after saving scene. But I can live with that
Thanks for expandString tip, will check that.
Yeah, it needs to go under python26 folder, and it works nice than.
I figured out that I have to convert to forward slashes. I used .replace for first part of path, one that I am getting from wx DriDialog and rest is added using posixpath module. Scripts works really nice, except it does not store in $HIP after saving scene. But I can live with that
Thanks for expandString tip, will check that.
Yeah, it needs to go under python26 folder, and it works nice than.
-
- Quick Links