Hi Everyone,
Hope you are all well. We have not been using houdini long. We are long time soft users and we are testing out software to move too and see the strengths of them. Houdini is our first choice for the sheer scope of it, so we have started looking at this first. Anyways, explaination of the problem below.
I am trying to script a "simple" saving function through a HDA via Python (I dont know if this is a correct way of doing it, so please If I am going in the wrong direction, shout) it will create a few folders based on some parameters in the HDA interface and save the file with the name specified. I am setting environment variables through this and using that to generate the path for the file save and also will hopefully re-use the Environment variables later for ROP output ETC for the scene.
I am running into an error with what I believe is to do with the hou.hipFile.save function. I have not been coding for very long either so please bare with me if my Termanology is off also.
I have attached some code snippets.
I am basically trying to save the files to a structured job folder system. something like below.
$JOB/scene/[WORKCATAGORY]/[SHOTFOLDER]/SHOTNAME.hipnc
I have defined some functions in the Python Module in the HDA, and these are being called by the callback script on each parameter.
It is really weird, It has worked once or twice. But then I try to save again and it does not work again.
I did some debugging and the Error that houdini generates, it definately works when I take out the SHOTFOLDER in the string for the path to save to. If my file path is just saved in the WORKCATAGORY section it saves.
My defined functions (sorry code is messy)
def shotName(parm):
hou.putenv("SHOTNAME", parm)
test = parm
print test
def folderName(parm):
fname = "NN_" + parm
hou.putenv("FOLDERNAME", fname)
test = fname
print test
def workCatagory(node, parm):
a = hou.parm(parm.path()).eval()
labelName = hou.parm(parm.path()).menuLabels()[a]
testA = parm
hou.putenv("WORKCATAGORY", labelName)
print labelName
def customSave():
#Pull in Enviroment Variables
work = hou.getenv("WORKCATAGORY")
shot = hou.getenv("SHOTNAME")
folder = hou.getenv("FOLDERNAME")
# Houdini save path FULL
savePath = "$JOB/scene/" + work + "/" + folder + "/" + shot + ".hipnc"
# Houdini save path with a job catagory but not job name folder
#savePath = "$JOB/scene/" + work + "/" + shot + ".hipnc"
exSavePath = hou.expandString(savePath)
exSavePath = exSavePath.replace('//', '/')
#hou.putenv("SAVEPATH", exSavePath )
hou.hipFile.save(exSavePath, False)
print exSavePath
the error it generates is
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "opdef:/Object/Northforge3_testa?PythonModule", line 40, in customSave
File "C:/PROGRA~1/SIDEEF~1/HOUDIN~1.600/houdini/python2.7libs\houpythonportion.py", line 1287, in decorator
return func(*args, **kwargs)
File "C:/PROGRA~1/SIDEEF~1/HOUDIN~1.600/houdini/python2.7libs\hou.py", line 28330, in save
return _hou.hipFile_save(*args, **kwargs)
OperationFailed: The attempted operation failed.
Error creating file: W:/Work/Development/D00026_Houdini_test/3.3d/D00026_Houdini_test_HOUDINI/scene/rend/NN_test/test.hipnc
working enviroment is.
Windows 10
Houdini Apprentice 16.0
saving to a NAS drive
I hope some of that makes sense. Cheers