Python hou.hipFile.save and wx problem

   8942   5   1
User Avatar
Member
379 posts
Joined: 12月 2006
Online
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’.
User Avatar
Member
379 posts
Joined: 12月 2006
Online
I found what was causing error. I just had to parse that variable as string, which I was sure it already is…

Anyway still question about PyQt and Houdini, can not find anything helpful.
User Avatar
Member
379 posts
Joined: 12月 2006
Online
Found one more problem, hou.hipFile.save() does not set $HIP variable when it saves file, which basically kicks me between legs as I was fighting with saving issue for last several hours ….
User Avatar
Member
7809 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.
User Avatar
Member
7809 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]
User Avatar
Member
379 posts
Joined: 12月 2006
Online
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.
  • Quick Links