On 03/12/13 13:51, Mr. Daniel Browne wrote:
> The solution I ultimately found was to set:
> export PYTHONHOME=/usr/autodesk/maya2013-x64
I see.. so it sounds like just that variable was the problem.
But, hmm, isn't that telling the OS's version of python
to use autodesk's version of python, and thus a potential
for crashing python due to possibly incompatible modules?
I think it'd be safer to simply unset the PYTHONHOME variable
so that the OS's python uses its own defaults, e.g.
os.system("unset PYTHONHOME; python /your/script.py")
Or, using the longer form technique I wrote earlier, the only
benefit being it should work across platforms, and can be expanded
to handle other variables if, for instance, the Windows version of
python has other settings that are needed:
---- snip
import os
def MySystem(cmd):
# SAVE OLD PYTHONHOME
if os.environ.has_key("PYTHONHOME"): phsave = os.environ["PYTHONHOME"]
else: phsave = None
# CHANGE TO WHAT OS WANTS
if os.environ.has_key("PYTHONHOME"): del os.environ["PYTHONHOME"]
# INVOKE UNIX COMMAND
os.system(cmd)
# RESTORE PYTHONPATH
if phsave != None: os.environ["PYTHONHOME"] = phsave
---- snip
So if you define that inside maya's python environment,
you can then run unix commands with:
MySystem(your_unix_command)
..and external calls to python will be protected from maya's PYTHONHOME.
--
Greg Ercolano, erco@(email surpressed)
Seriss Corporation
Rush Render Queue, http://seriss.com/rush/
Tel: (Tel# suppressed)ext.23
Fax: (Tel# suppressed)
Cel: (Tel# suppressed)
|