> Are you running Maya 2011? If so, you probably need to specify some
> environment information to the python25 interpreter. When Maya starts up it
> does some manipulation to sys.path and some other environment info. You are
> probably calling the python25 interpreter, but inheriting the python26
> configuration established by Maya.
Correct -- I'm running Maya 2011.
You could test this easily enough by creating your own python script an
> calling it in place of the one you want to run now. You could do something
> like:
>
> import sys, os
> FILE = open( "C:/temp/python_environ_data.txt", 'w')
> FILE.write('sys.path:\n')
> FILE.write( '\n'.join(sys.path) )
>
> for var in os.environ.keys():
> FILE.write( "%s=%s\n"%(var, os.environ[var]))
>
> FILE.close()
>
>
> That code might not do exactly what you want (I didn't run it), but it
> should get you pretty close.
>
Maybe running a tcsh/bash script to a) set the environment then b) run the
script?
I'll give it a try.
It's just odd that I can do this type of stuff outside of Maya 2011, just
not *IN* it ...
Thanks!
hoaf
ps -- I tried monkeying around with the optional "env" argument on
subprocess, but didn't have much luck:
import os, subprocess
myEnv = os.environ.copy()
## Environment modifications here:
myEnv.update(PYTHONPATH=<something>)
subprocess.subprocess(myCmd, env=myEnv, [options here]).communicate()
[..]
An intermediary script sounds better, though. :^)
On Sat, Jan 22, 2011 at 7:04 AM, Geoff Harvey <[email protected]> wrote:
> Hello!
>
> Long time listener, first time caller.
>
> I've run into a situation where I need to launch gather some data from
> a python script.
>
> The script I need to run happens to be long, complicated, and requires
> python2.5.
>
> Thing is, when I launch it via subprocess from a python script inside
> of Maya, I get a bunch of incompatibility errors, starting with the
> inability to import the os module.
>
> Running the same scenario outside of Maya (ie, launching the python2.5
> script inside a python2.6 shell) works just swell.
>
> Any ideas on how to do this?
>
> Thanks in advance!
>
> --
> http://groups.google.com/group/python_inside_maya
>
--
http://groups.google.com/group/python_inside_maya
--
http://groups.google.com/group/python_inside_maya