You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by GitBox <gi...@apache.org> on 2022/04/14 18:52:48 UTC

[GitHub] [beam] robertwb commented on a diff in pull request #17366: [BEAM-17035] Call python3 directly when it is available.

robertwb commented on code in PR #17366:
URL: https://github.com/apache/beam/pull/17366#discussion_r850718537


##########
sdks/java/extensions/python/src/main/java/org/apache/beam/sdk/extensions/python/PythonService.java:
##########
@@ -96,6 +95,18 @@ public AutoCloseable start() throws IOException, InterruptedException {
     return p::destroy;
   }
 
+  private String whichPython() {
+    for (String executable : ImmutableList.of("python3", "python")) {
+      try {
+        new ProcessBuilder(executable, "--version").start().waitFor();
+        return executable;
+      } catch (IOException | InterruptedException exn) {
+        // Ignore.

Review Comment:
   It will move on to the next item in the list above, trying to find some python in the path. In this case, first we're trying python3, and if that fails we try plain old python, and if that fails we give up (though we could add other items in this list as needed). 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org