ch3 Posted June 3, 2014 Share Posted June 3, 2014 I am putting together a python script to render multiple files sequentially on a windows machine via cygwin. A rather big pain as I had to resolve all the path madness (\ vs /)... but it's almost there... For some strange reason $HIPNAME on the output path of the rop node, evaluates to the full path and not just the file name. So whenever I use it on my output path (...project/renders/$HIPNAME:r/$HIPNAME:r.$F4.exr), it resolves to a non existing long path (...project/renders/...project\renders/...project\renders.$F4.exr) and fails When I render my scene from the terminal via hscript it works fine. I wouldn't be surprised if it's another confusion caused by cygwin. But I was wondering if it's possible to change the content of a variable via python, in the same way you can do via the Alias & Variables UI. I just want to test whether it will work if I set it my self to the filename, prior to executing the render. thanks Quote Link to comment Share on other sites More sharing options...
Dee Posted June 3, 2014 Share Posted June 3, 2014 Hey! Yeah, you can do that, although I'm not sure of the python specific version. When I've been wanting to change a global variable in some code evaluated by hython or hscript, I just use this:set -g name = value I don't know that there's a hython equivalent, but this will let you do it in hython as a workaround: hou.hscript('set -g name = value') Does anyone else have a better way to do that? I am putting together a python script to render multiple files sequentially on a windows machine via cygwin. A rather big pain as I had to resolve all the path madness (\ vs /)... but it's almost there... For some strange reason $HIPNAME on the output path of the rop node, evaluates to the full path and not just the file name. So whenever I use it on my output path (...project/renders/$HIPNAME:r/$HIPNAME:r.$F4.exr), it resolves to a non existing long path (...project/renders/...project\renders/...project\renders.$F4.exr) and fails When I render my scene from the terminal via hscript it works fine. I wouldn't be surprised if it's another confusion caused by cygwin. But I was wondering if it's possible to change the content of a variable via python, in the same way you can do via the Alias & Variables UI. I just want to test whether it will work if I set it my self to the filename, prior to executing the render. thanks Quote Link to comment Share on other sites More sharing options...
Dee Posted June 3, 2014 Share Posted June 3, 2014 Although, according to the help files you could use setenv, too. setenv name = value hou.hscript('setenv name = value') Hey! Yeah, you can do that, although I'm not sure of the python specific version. When I've been wanting to change a global variable in some code evaluated by hython or hscript, I just use this:set -g name = value I don't know that there's a hython equivalent, but this will let you do it in hython as a workaround: hou.hscript('set -g name = value') Does anyone else have a better way to do that? Quote Link to comment Share on other sites More sharing options...
ch3 Posted June 5, 2014 Author Share Posted June 5, 2014 Cool, thanks a lot Dee I managed to make it work. I now have a .bat icon on my desktop that runs cygwin and a shell batch file for multiple sequential renders. Each render command is a python script that does various checks and runs a hython script to do the actual render. Between all theses, I had to wrangle the madness between unix/win paths, slashes, backslashes, double backslashes, quadruple backslashes, global variables and more! I think I now need a beer! Quote Link to comment Share on other sites More sharing options...
Dee Posted June 5, 2014 Share Posted June 5, 2014 (edited) Why not run it through a process or something? Set up your paths so they are similar on both... I'm just doing this off the top of my head and I'm still learning python, but wouldn't it be something like this: path = 'path/to/information' def makePath(path): basepathwin = 'C:\\' basepathlin = '/media/storage/houdini/data/' import platform platform = platform.system() finalpath = '' if platform == 'Linux': finalpath = basepathlin + path else: pathsplit = path.split('/') finalpath = pathwin foreach item pathsplit: finalpath = finalpath + item + '\' return finalpath print makePath(path) Would that not allow you to store your paths in the unix standard but, if you were on windows, convert them to the proper paths depending? That does sound like a lot of hassle, though. Edited June 5, 2014 by Dee Quote Link to comment Share on other sites More sharing options...
ch3 Posted June 6, 2014 Author Share Posted June 6, 2014 cygwin provides a command to do that and turn a path from windows to unix and vice versa. But even with that it was a bit of a pain, as passing windows line paths as arguments and variables, require to double the backslashes before hand, so they are not considered as escape characters. It's all done now... I may just need to re-work the retry logic for certain cases. Actually while on the topic... do you know of a way to tell if an exr is incomplete? Right now I am just checking with the file size, but it's hard to decide on an accurate threshold, as an incomplete exr still has partial data in it. Quote Link to comment Share on other sites More sharing options...
ch3 Posted June 6, 2014 Author Share Posted June 6, 2014 I just noticed there is iinfo which comes with houdini and check the integrity of an image file!I think this will do the job! =] Quote Link to comment Share on other sites More sharing options...
Dee Posted June 6, 2014 Share Posted June 6, 2014 Awesome! I didn't know that. Where is that? It sounds like a useful function. I just noticed there is iinfo which comes with houdini and check the integrity of an image file!I think this will do the job! =] cygwin provides a command to do that and turn a path from windows to unix and vice versa. But even with that it was a bit of a pain, as passing windows line paths as arguments and variables, require to double the backslashes before hand, so they are not considered as escape characters. It's all done now... I may just need to re-work the retry logic for certain cases. Actually while on the topic... do you know of a way to tell if an exr is incomplete? Right now I am just checking with the file size, but it's hard to decide on an accurate threshold, as an incomplete exr still has partial data in it. Quote Link to comment Share on other sites More sharing options...
ch3 Posted June 7, 2014 Author Share Posted June 7, 2014 in houdini's bin folder Quote Link to comment Share on other sites More sharing options...
Dee Posted June 7, 2014 Share Posted June 7, 2014 Yes, I figured that, but which one is it? There's a lot of stuff in there...? Where did you find it in the docs? in houdini's bin folder Quote Link to comment Share on other sites More sharing options...
ch3 Posted June 8, 2014 Author Share Posted June 8, 2014 $ iinfoUsage: iinfo [-i] [-s] picfile [picfile*]Gives information about picture files -i check file integrity -s supress output -b print out basic information only Quote Link to comment Share on other sites More sharing options...
Dee Posted June 8, 2014 Share Posted June 8, 2014 Ooooh, awesome! Thanks! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.