Jump to content
art3mis

Using custom Python modules

Recommended Posts

Posted (edited)

Hi

Is anyone aware of any good beginners tutorials on using custom Python modules with Houdini?

Have been trying now for days to get ytini http://www.ytini.com/getstarted.html

working in Ubuntu, but whatever I try always end up getting

'module not found'

 when I do an

>import yt

in the Python shell.

Edited by art3mis

Share this post


Link to post
Share on other sites

I had same problem when I was trying to load  module .Then i got help from Doc.

This is from Doc:

In general, Houdini looks for "scripts" (usually callback scripts) on disk under HOUDINIPATH/scripts/, while modules you would import are under HOUDINIPATH/python2.7libs/. Unfortunately, this is not consistent, so for example Houdini looks for the pythonrc.py initialization script in python2.7libs.

for more : http://www.sidefx.com/docs/houdini/hom/locations.html

Share this post


Link to post
Share on other sites

Thanks!

Couple other noob questions

In the Python Shell what is the difference between

os.environ['PATH']

and

sys.path ?

And if you type

os.environ['PYTHONPATH']

What should it return? (assuming you haven't altered PYTHONPATH)

Share this post


Link to post
Share on other sites
24 minutes ago, art3mis said:

Thanks!

Couple other noob questions

In the Python Shell what is the difference between


os.environ['PATH']

and


sys.path ?

And if you type


os.environ['PYTHONPATH']

What should it return? (assuming you haven't altered PYTHONPATH)

os.environ['PATH'] : refers to the PATH environment variable, which is a list of directories the operating system tries to find an executable in if you try to start an application without an absolute or relative path like  you can set PATH environment variable to houdini bin directory , then you just type mplay in cmd to run mplay.

os.environ['PYTHONPATH'] : https://docs.python.org/2/using/cmdline.html#envvar-PYTHONPATH

sys.path: are the directories Python searches for modules in when you try to import one

I hope It will help.

Share this post


Link to post
Share on other sites

Thanks.

>>> import sys
>>> sys.path.append("/home/jim/yt-conda/bin")

And then type

>>>import yt

 

Still get an error:(

ImportError: No module named yt

even though yt IS in my bin folder. Something strange is happening.

Share this post


Link to post
Share on other sites
Posted (edited)

Sorry I couldn't reply to your other thread. Did you try to install yt using the pip install method ?

I didn't have conda installed so I just tried to install using pip real quick and I was able to import yt fine in Houdini. Could you give that a try and see if it works ?

 

-J

 

Edited by animknight

Share this post


Link to post
Share on other sites
Posted (edited)

Thanks!  

used the install script.

Are you on Linux?

I am fairly confident ytini is installed correctly.... but Houdini doesn’t seem to recognize the path I have set... trying to troubleshoot in the Houdini Python shell but not a Python guru.

For instance the instructions suggest doing an 

import yt

but isn’t import only for modules?

I've tried every possible permutation if setting PATH and even trying to set PYTHONPATH 

 

Edited by art3mis

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

×