Parameters and Python

   2296   3   0
User Avatar
Member
10 posts
Joined: 1月 2017
Offline
I'm creating a digital asset that exports data from the geometry spreadsheet into a CSV. However, whenever trying to reference in parameters from the digital asset, I get errors about “NoneType has no attribute ____”. I know that this is due to the hou.node() function messing up, but there's no clear way for me to resolve it. I've attached my hip file and hda file, where I can explain further. Any help is appreciated. If you want me to explain in more detail in the thread, just let me know!

EDIT: To elaborate a little more, all of my code is in the Scripts tab of the Type properties of my digital asset. The asset can be run by hitting the “GO” button, and then that's when you get the errors.
Edited by jderry2019 - 2018年6月28日 15:47:43

Attachments:
pythontest.hipnc (257.5 KB)
jasmine_output_particles.hda (7.6 KB)

User Avatar
スタッフ
3463 posts
Joined: 7月 2005
Offline
change the button callback to this:
hou.pwd().hdaModule().executeButton(kwargs)

and change your code to this:
def executeButton(kwargs):
    node = kwargs["node"]

there are other errors but this will get you past the first ones
Michael Goldfarb | www.odforce.net
Training Lead
SideFX
www.sidefx.com
User Avatar
Member
323 posts
Joined: 1月 2015
Offline
just a wild guess but maybe you can learn from this:

https://www.sidefx.com/forum/topic/56573/ [www.sidefx.com]

the tool exports data to csv files…
User Avatar
Member
10 posts
Joined: 1月 2017
Offline
goldfarb
change the button callback to this:
hou.pwd().hdaModule().executeButton(kwargs)

and change your code to this:
def executeButton(kwargs):
    node = kwargs["node"]

there are other errors but this will get you past the first ones

Thanks so much! Changing the callback (along with some other code cleanup) was what did the trick!
  • Quick Links