python module in HDA

   2547   3   3
User Avatar
Member
18 posts
Joined: Sept. 2013
Offline
I am trying to figure out why my HDA is erroring out. I am still in 13.

If you install the OTL there is an object level HDA called pythondev.

When you first lay it down it errors saying:
Traceback (most recent call last):
File “opdefObject/pythondev?PythonModule”, line 3, in <module>
AttributeError: ‘NoneType’ object has no attribute ‘path’

now if you lay down the node again it's fine.

Why does this happen?

OTL included as attachment

Thanks,

</Ross>

Attachments:
pythonTest_03.otl (8.4 KB)

lights, camera, … life …
User Avatar
Member
1904 posts
Joined: Nov. 2006
Offline
The problem is that you have code in your PythonModule that assumes the existence of an instance of that particular node, which isn't correct. The PythonModule is a global module to your custom node type, not an actual instance of your node.

What's happening in this case is that the module is loaded before your node is first put down. but not any subsequent times (unless you modify it throguh the Type Properties). When this occurs it runs the first line (node will be /). The second line will not be able to find your “CONTROL” node so myControl is None and your third line then fails with this error. When you put the node down again the code isn't run so there is no error.
Graham Thompson, Technical Artist @ Rockstar Games
User Avatar
Member
18 posts
Joined: Sept. 2013
Offline
Got it.

Thanks Graham!
lights, camera, … life …
User Avatar
Member
81 posts
Joined: Feb. 2014
Offline
I am having sort the same issue. I try to insert some buttons in a hda interface, which invoke parts of an python module. On dropping those hda’s in the scene I get the message, and my custom buttons don’t work. After diving into the python module, doing nothing but hitting ‘apply’ nonetheless, everything works again.
Reading this it all seems to be not a very clean way to go, is it? Or are there fixes possible which makes it run the first time?
  • Quick Links