you need to mimic what is going on in mayapy.  on osx and linux mayapy  
is just a shell script that sets up some environment variables before  
launching maya's python interpreter.  here's what it looks like:

#!/bin/sh

path=`dirname $0`
pythonhome=$path/../Frameworks/Python.framework/Versions/Current
export PYTHONHOME=$pythonhome
export DYLD_LIBRARY_PATH=$path/../MacOS:$DYLD_LIBRARY_PATH
export DYLD_FRAMEWORK_PATH=$path/../Frameworks:$DYLD_FRAMEWORK_PATH
export MAYA_LOCATION=$path/..
exec $pythonhome/Resources/Python.app/Contents/MacOS/Python "$@"

here's a breakdown of what's happening in this script:
1) get the location of the mayapy file.  this is the maya bin directory
2) set PYTHONHOME to maya's python interpreter.  there is nothing  
special about maya's interpreter, other than it is guaranteed to work  
with maya's libraries ( same python version, same compiler, etc ).
3) set DYLD_LIBRARY_PATH so that maya's libraries are found, otherwise  
you get the "Library not loaded" error
4) set DYLD_FRAMEWORK_PATH so that maya's python framework is found  
and used.  on osx, i think this is redundant with PYTHONHOME, which is  
a more brute force method, but i might be mistaken.
5) set MAYA_LOCATION
6) execute maya's python interpreter


to get Idle working, you need to make sure you properly set  
DYLD_LIBRARY_PATH and DYLD_FRAMEWORK_PATH.  on osx these values are:

DYLD_LIBRARY_PATH    /Applications/Autodesk/maya2009/Maya.app/Contents/ 
MacOS
DYLD_FRAMEWORK_PATH    /Applications/Autodesk/maya2009/Maya.app/ 
Contents/Frameworks

hope that helps.

-chad







On Jul 26, 2009, at 12:07 PM, Paige Young wrote:

>
> Hi,
>
> I've been trying to get Python Idle to work with Maya for a while now
> and I just can't get it to work. I'm on a mac with Leopard. I set my
> environment variables up with PListEdit Pro so the pythonpath is:
>
> /Applications/Autodesk/maya2008/maya.app/Contents/Frameworks/
> Python.framework/Versions/Current/lib/python2.5/site-packages/
>
> and the Maya location is:
>
> /Applications/Autodesk/maya2008/maya.app/Contents
>
>
> But I keep getting this error just trying to run maya.standalone and I
> don't know how to fix it:
>
> Traceback (most recent call last):
>  File "/Users/hoshi87/Documents/test.py", line 1, in <module>
>    import maya.standalone
> ImportError: dlopen(/Applications/Autodesk/maya2008/maya.app/Contents/
> Frameworks/Python.framework/Versions/Current/lib/python2.5/site-
> packages/maya/standalone.so, 2): Library not loaded: @executable_path/
> libMaya.dylib
>  Referenced from: /Applications/Autodesk/maya2008/maya.app/Contents/
> Frameworks/Python.framework/Versions/Current/lib/python2.5/site-
> packages/maya/standalone.so
>  Reason: image not found
>
> Can someone please help me?
>
> >


--~--~---------~--~----~------------~-------~--~----~
http://groups.google.com/group/python_inside_maya
-~----------~----~----~----~------~----~------~--~---

Reply via email to