Finally fix those darn Maya crashes

This commit is contained in:
rdb 2010-12-19 07:56:41 +00:00
parent 0ea72a4712
commit 124942a13b
3 changed files with 11 additions and 1 deletions

View File

@ -229,7 +229,7 @@ ns_get_environment_variable(const string &var) const {
} else if (var == "MAIN_DIR") {
#ifdef HAVE_PYTHON
// If we're running from Python code, read out sys.argv.
if (Py_IsInitialized()) {
if (!ns_has_environment_variable("PANDA_INCOMPATIBLE_PYTHON") && Py_IsInitialized()) {
PyObject* obj = PySys_GetObject((char*) "argv");
if (obj) {
Filename main_dir = Filename::from_os_specific(PyString_AsString(PyList_GetItem(obj, 0)));

View File

@ -320,6 +320,11 @@ int main(int argc, char **argv)
_putenv(env1);
_putenv(env2);
#endif // _WIN32
// When this is set, Panda3D will try not to use any functions from the
// CPython API. This is necessary because Maya links with its own copy
// of Python, which may be incompatible with ours.
_putenv("PANDA_INCOMPATIBLE_PYTHON=1");
#ifdef _WIN32
STARTUPINFO si; PROCESS_INFORMATION pi;

View File

@ -157,6 +157,11 @@ main(int argc, char *argv[]) {
#endif // IS_OSX
// When this is set, Panda3D will try not to use any functions from the
// CPython API. This is necessary because Maya links with its own copy
// of Python, which may be incompatible with ours.
putenv("PANDA_INCOMPATIBLE_PYTHON=1");
// Now that we have set up the environment variables properly, chain
// to the actual maya2egg_bin (or whichever) executable.