save hipfile from Python SOP

   643   1   1
User Avatar
Member
76 posts
Joined: March 2007
Offline
Hi there,

Like the topic says.. just want to do a
hou.hipFile.save()
from a Python SOP.
But I get an error.
Python error: Traceback (most recent call last):
File "<stdin>", line 14, in <module>
File "D:/dev/HRZ2/tools/Software/Houdini/Houdini 18.0.499/houdini/python2.7libs\houpythonportion\ui.py", line 927, in decorator
return func(*args, **kwargs)
File "D:/dev/HRZ2/tools/Software/Houdini/Houdini 18.0.499/houdini/python2.7libs\hou.py", line 40011, in save
return _hou.hipFile_save(*args, **kwargs)
OperationFailed: The attempted operation failed.
Node cook is in progress

I've also tried the Script SOP but that gives the same result.
Does anyone know how to deal with this properly or a way around it.
I'm doing this for debugging and have no control over the cooking of this HDA. Need to solve it in the HDA.

I'm considering a pressButton from the Python SOP to the parent HDA and then run a callback script.
In the hope the GUI command gets deferred and ran later than the Python SOP cook or something.
But maybe there is a cleaner way.

Anyone?

cheers,
benS
Edited by ben5ch - Oct. 14, 2021 13:01:09
User Avatar
Member
76 posts
Joined: March 2007
Offline
Aha found this..

def runLater():
    hou.ui.displayMessage("Hello World")

import hdefereval
hdefereval.executeDeferred(runLater)

Yes that seems to work
  • Quick Links