Python Script problems
2256 7 1- Konorev
- Member
- 9 posts
- Joined: Sept. 2016
- Offline
So the situation is like this. I have a selection of files that I need to process with SOP network, then open that geometry in python and write out a json file per work item. It all works fine except for that python script. Python script for some reason doesnt update PDG attributes that I use in SOP network to load a correct file per work item. All my json files a exactly the same size, so it looks like that python script updates only the first active work item attributes and the rest of the items get exactly the same set of attributes, because all resulting JSON files are the same size and comes from the very last work item I have manually checked. I tried everything and I have no idea how to fix this. All my PDG attributes are correct as well.
- tpetrick
- Staff
- 585 posts
- Joined: May 2014
- Offline
- Konorev
- Member
- 9 posts
- Joined: Sept. 2016
- Offline
- Konorev
- Member
- 9 posts
- Joined: Sept. 2016
- Offline
- chrisgreb
- Member
- 603 posts
- Joined: Sept. 2016
- Offline
The problem is that pythonscript1 is being evaluated in-process. This means all the items are working in your current houdini session, so /obj/topnet/PrepareGeometry/file1 is evaluating `@pdg_input` to whatever your current selected item is. This is why all the json files are the same.
If you want to modify the geometry you can use an Invoke TOP node. With an Invoke you would need to put your attribwrangle into a Compiled Block.
Then you should use another Geometry Import to bring the attributes you want back into PDG where you can safely use a pythonscript to write out a text file or whatever.
If you want to modify the geometry you can use an Invoke TOP node. With an Invoke you would need to put your attribwrangle into a Compiled Block.
Then you should use another Geometry Import to bring the attributes you want back into PDG where you can safely use a pythonscript to write out a text file or whatever.
- Konorev
- Member
- 9 posts
- Joined: Sept. 2016
- Offline
- tpetrick
- Staff
- 585 posts
- Joined: May 2014
- Offline
You can uncheck the “Evaluate In Process” toggle on the Python Script node. The script will be run in a separate hython child process created by the local scheduler. If you want to access your hip file, you'll need to something like the following:
That will load the current .hip file into that Hython session.
import hou hou.hipFile.load("$HIPFILE")
That will load the current .hip file into that Hython session.
- tpetrick
- Staff
- 585 posts
- Joined: May 2014
- Offline
-
- Quick Links