Remember 3December
Find out where to celebrate your 3D CG art...
  • 1/3
You are here:Forum Home / Autodesk® MotionBuilder® / Python / Loading Proprietary Python Modules
  RSS 2.0 ATOM  

Loading Proprietary Python Modules
Rate this thread
 
36414
 
Subscribe to this thread
avatar
  • Location: Eugene, Oregon
  • Total Posts: 64
  • Joined: 2006-08-26 06:43:42

Hi all,

I posted this a while ago but it posted it rather vaguely so i figured i put a slightly more descriptive question:

I am having issues trying to load some of our proprietary modules inside motion Builder. I have found several places that work but none consistantly.

There is a python startup folder path that i have set, that doesnt seem to do anything, and there is a USER.Python.txt that saves the last opened filepath inside the python editor.

So far only editing the txt file will allow me access to the modules, the downside to doing that is as soon as i open a new file that is outside that path it changes the “Last Path” string inside the txt file. I would think that the path inside preferences should be the correct way to do this but i have been unlucky so far.

Is there something i am missing?



Replies: 0
avatar
  • csa3d
  • Posted: 08 November 2009 09:37 AM
  • Total Posts: 18
  • Joined: 2006-10-13 20:12:47

What I have done is to create a file in the PythonStartup folder called “userStartup.py”.  This file loads all the external modules.  To do so, place the following lines in it:

import sys
sys
.path.append( "c:/Path/to/your/external/module" )

This will add the module to your PYTHONPATH, so assuming you have a valid module there, it will find it.  If you need to run a def from this module at startup, this file is the place to do that as well.

You could alternatively add a “PYTHONPATH” environment variable with a value of “c:\path\to\your\external\module;” to your machine Start, Settings, Control Panel, System, Advanced Tab, Environment Variables

-csa



Replies: 0
avatar
  • Location: Eugene, Oregon
  • Total Posts: 64
  • Joined: 2006-08-26 06:43:42

Awesome! that is just what i needed to know!

Thanks!



Replies: 0




   
  Settings Choose Theme color: