diff --git a/source/libs/function/src/udfd.c b/source/libs/function/src/udfd.c index ed5f87647f0a54c1b4f40fd213933d4751573730..0e3c6a4defaf543a7a36f33323cf64c2ac32e9b3 100644 --- a/source/libs/function/src/udfd.c +++ b/source/libs/function/src/udfd.c @@ -347,8 +347,16 @@ void udfdInitializePythonPlugin(SUdfScriptPlugin *plugin) { return; } if (plugin->openFunc) { - SScriptUdfEnvItem items[] ={{"PYTHONPATH", tsUdfdLdLibPath}}; + int16_t lenPythonPath = strlen(tsUdfdLdLibPath) + strlen(tsTempDir) + 1 + 1; //tsTempDir:tsUdfdLdLibPath + char* pythonPath= taosMemoryMalloc(lenPythonPath); + #ifdef WINDOWS + snprintf(pythonPath, lenPythonPath, "%s;%s", tsTempDir, tsUdfdLdLibPath); + #else + snprintf(pythonPath, lenPythonPath, "%s:%s", tsTempDir, tsUdfdLdLibPath); + #endif + SScriptUdfEnvItem items[] ={{"PYTHONPATH", pythonPath}}; plugin->openFunc(items, 1); + taosMemoryFree(pythonPath); } plugin->libLoaded = true; return;