| 3130 | } |
| 3131 | |
| 3132 | void |
| 3133 | AppManager::launchPythonInterpreter() |
| 3134 | { |
| 3135 | std::string err; |
| 3136 | std::string s = "app = app1\n"; |
| 3137 | bool ok = NATRON_PYTHON_NAMESPACE::interpretPythonScript(s, &err, 0); |
| 3138 | |
| 3139 | assert(ok); |
| 3140 | if (!ok) { |
| 3141 | throw std::runtime_error("AppInstance::launchPythonInterpreter(): interpretPythonScript(" + s + " failed!"); |
| 3142 | } |
| 3143 | |
| 3144 | PyGILState_Ensure(); // Py_Main does PyGILState_Release() for us. |
| 3145 | |
| 3146 | assert(PyThreadState_Get()); |
| 3147 | #if PY_VERSION_HEX >= 0x030400F0 |
| 3148 | assert(PyGILState_Check()); // Not available prior to Python 3.4 |
| 3149 | #endif |
| 3150 | |
| 3151 | #if PY_MAJOR_VERSION >= 3 |
| 3152 | // Python 3 |
| 3153 | Py_Main(1, &_imp->commandLineArgsWide[0]); |
| 3154 | #else |
| 3155 | Py_Main(1, &_imp->commandLineArgsUtf8[0]); |
| 3156 | #endif |
| 3157 | } |
| 3158 | |
| 3159 | int |
| 3160 | AppManager::isProjectAlreadyOpened(const std::string& projectFilePath) const |