This is an automated email from the ASF dual-hosted git repository.
dianfu pushed a commit to branch release-1.10
in repository https://gitbox.apache.org/repos/asf/flink.git
The following commit(s) were added to refs/heads/release-1.10 by this push:
new 2eaba74 [FLINK-20183][python] Fix the default PYTHONPATH is
overwritten in client side
2eaba74 is described below
commit 2eaba7499dbdd3447425e54bea024fc09142a517
Author: Dian Fu <[email protected]>
AuthorDate: Wed Nov 18 16:33:14 2020 +0800
[FLINK-20183][python] Fix the default PYTHONPATH is overwritten in client
side
This closes #14108.
---
.../org/apache/flink/client/python/PythonDriverEnvUtils.java | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git
a/flink-python/src/main/java/org/apache/flink/client/python/PythonDriverEnvUtils.java
b/flink-python/src/main/java/org/apache/flink/client/python/PythonDriverEnvUtils.java
index 7637c5a..4578480 100644
---
a/flink-python/src/main/java/org/apache/flink/client/python/PythonDriverEnvUtils.java
+++
b/flink-python/src/main/java/org/apache/flink/client/python/PythonDriverEnvUtils.java
@@ -24,6 +24,8 @@ import org.apache.flink.core.fs.FileSystem;
import org.apache.flink.core.fs.Path;
import org.apache.flink.util.FileUtils;
+import org.apache.flink.shaded.guava18.com.google.common.base.Strings;
+
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -211,7 +213,12 @@ public final class PythonDriverEnvUtils {
public static Process startPythonProcess(PythonEnvironment pythonEnv,
List<String> commands) throws IOException {
ProcessBuilder pythonProcessBuilder = new ProcessBuilder();
Map<String, String> env = pythonProcessBuilder.environment();
- env.put("PYTHONPATH", pythonEnv.pythonPath);
+ String defaultPythonPath = env.get("PYTHONPATH");
+ if (Strings.isNullOrEmpty(defaultPythonPath)) {
+ env.put("PYTHONPATH", pythonEnv.pythonPath);
+ } else {
+ env.put("PYTHONPATH", String.join(File.pathSeparator,
pythonEnv.pythonPath, defaultPythonPath));
+ }
pythonEnv.systemEnv.forEach(env::put);
commands.add(0, pythonEnv.pythonExec);
pythonProcessBuilder.command(commands);