MCPcopy Create free account
hub / github.com/OSGeo/gdal / GDALPythonInitialize

Function GDALPythonInitialize

gcore/gdalpython.cpp:811–830  ·  view source on GitHub ↗

Call this to initialize the Python environment. */

Source from the content-addressed store, hash-verified

809/** Call this to initialize the Python environment.
810 */
811bool GDALPythonInitialize()
812{
813 std::lock_guard<std::mutex> guard(gMutexGDALPython);
814
815 if (!LoadPythonAPI())
816 return false;
817
818 int bIsInitialized = Py_IsInitialized();
819 if (!bIsInitialized)
820 {
821 gbHasInitializedPython = true;
822 CPLDebug("GDAL", "Before Py_Initialize()");
823 Py_InitializeEx(0);
824 CPLDebug("GDAL", "Py_Initialize()");
825 PyEval_InitThreads();
826 gphThreadState = PyEval_SaveThread();
827 }
828
829 return true;
830}
831
832/************************************************************************/
833/* GDALPythonFinalize() */

Callers 4

RunImplMethod · 0.85
RunImplMethod · 0.85
InitializePythonMethod · 0.85

Calls 2

LoadPythonAPIFunction · 0.85
CPLDebugFunction · 0.85

Tested by

no test coverage detected