Jump to content
Sign in to follow this  
Atom

[SOLVED]Why doesn't print(dir(myvar)) work in Houdini?

Recommended Posts

Hi All,

 

As a python programmer I often use print(dir(var)) to see what other options are a vailable. This does not seem to work in Houdini. Most of the time I get the error dialog claiming that str object is not callable.

 

Does anyone know why this useful tool is not implemented in Houdini?

Edited by Atom

Share this post


Link to post
Share on other sites

Hi All,

 

As a python programmer I often use print(dir(var)) to see what other options are a vailable. This does not seem to work in Houdini. Most of the time I get the error dialog claiming that str object is not callable.

 

Does anyone know why this useful tool is not implemented in Houdini?

As a python programmer, you seem to override dir or print build-in  :) And print is a function only in Python3x, so i guess you're using from __future__ import print_function

Share this post


Link to post
Share on other sites

I am migrating from Blender to Houdini. Blender has already made the leap to python 3.0 so I guess old habits die hard. Are we still living in the python past with Houdini?

 

I am just looking for a way to use dir so I don't have to ask a hundred questions a day...

A lot of the time I could solve my own problems if I could just see what options were available within a given object/variable.

 

No one else uses dir?

Edited by Atom

Share this post


Link to post
Share on other sites

Just do:

print dir(var)

We are in python2 land in houdini.

 

 

You will probably also like

print help(var) 

if you didn't already know about that one.

Share this post


Link to post
Share on other sites

Thanks, I did not know the help(var), I'll try that.

 

@Stalker: Also I thought the mention of future_import was a joke, sorry about that. :wacko:

 

rhetorical question, no answer needed: So why are we still running on python 2? Isn't that like coding a web page in ASP or writing code in VB6..?

Share this post


Link to post
Share on other sites

Alot of studios have tons of code in python2 and Houdini as well. There haven't been any big reason to switch yet feature wise so easier to stick with python2. There are also some libs that don't exist for python3.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×