Jump to content

whats wrong with my code of HOU


san

Recommended Posts

why this code doesnt work

in python shell .. of houdini...

here is what i get

>>> g = hou.node("/obj/geo1")
>>> g
>>> g
>>> g.path()
Traceback (most recent call last):
  File "<console>", line 1, in <module>
AttributeError: 'NoneType' object has no attribute 'path'
>>> g = hou.node("/obj/geo1")
>>> g
>>> g.path()
Traceback (most recent call last):
  File "<console>", line 1, in <module>
AttributeError: 'NoneType' object has no attribute 'path'
>>>

Link to comment
Share on other sites

Well the code works fine for me. It is obviously not finding "/obj/geo1" in your scene which is why 'g' isn't getting assigned. If the node exists it will work, if not then I don't know what else to say.

Link to comment
Share on other sites

i got it when i create geometry the new default name is not geo1 dont know why..

So? Do you have the node /obj/geo1 or not? :)

The code works for me as well.

try this:

g = hou.node('/obj/geo1')

sometimes "/obj/geo1" causes problems compared to '/obj/geo1'

:blink:

Link to comment
Share on other sites

>>> g = hou.node("/obj/geo1")

>>> g

>>> g

>>> g.path()

Traceback (most recent call last):

File "<console>", line 1, in <module>

AttributeError: 'NoneType' object has no attribute 'path'

>>> g = hou.node("/obj/geo1")

>>> g

>>> g.path()

Traceback (most recent call last):

File "<console>", line 1, in <module>

AttributeError: 'NoneType' object has no attribute 'path'

>>>

According to this code it doesn't exist, simply because it printed None when you typed 'g' in the second line. Also, if it had been assigned correctly, you would have seen something along the lines of "Result: <obj geo1 blah blah blah>". If the node doesn't exist, do something like g = hou.node('/obj').createNode('geo','geo1').

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...