merge file from python script node

   652   2   0
User Avatar
Member
2 posts
Joined: 6月 2023
Offline
Hi there
I d like to merge a file from python script node
the code looks like that
in empty scene
in stage/
create Python script node

asset_file_name = "D:/file.hip"
hou.hipFile.merge(asset_file_name, node_pattern="*", overwrite_on_conflict=False, ignore_load_warnings=False)
mergedNode = hou.node("/stage/file_Node_USD")
mergedNode.parm("File").set("D:/File_USD.usd" )

if I run the script from shelf it works
but if I put the script inside a Python _script Node in the /stage

comes an error:

Error
Python error: Traceback (most recent call last):
File "<stdin>", line 7, in <module>
File "C:\PROGRA~1/SIDEEF~1/HOUDIN~1.640/houdini/python3.9libs\houpythonportion\ui.py", line 1119, in decorator
return func(*args, **kwargs)
File "C:\PROGRA~1/SIDEEF~1/HOUDIN~1.640/houdini/python3.9libs\hou.py", line 52202, in merge
return _hou.hipFile_merge(self, *args, **kwargs)
hou.OperationFailed: The attempted operation failed.
Node cook is in progress: /stage/pythonscript1

What I am doing wrong?
User Avatar
Member
193 posts
Joined: 12月 2016
Offline
can you post the script ?
A bit hard to debug without the source code.

That being said i have also had issues using kwargs inside a python node.
User Avatar
Member
8575 posts
Joined: 7月 2007
Online
I wouldn't advise doing that in a live python node, that's usually to modify the stage itself, not the scene nodegraph
do you really want to merge file every time that node is cooked? that can lead to all sorts of issues and I wouldn't be surprised if some operations were not allowed during cook
Edited by tamte - 2023年11月30日 16:28:32
Tomas Slancik
FX Supervisor
Method Studios, NY
  • Quick Links