0

How do I go about piping the output of a python program as an argument for a Java program?

I have the following code:

Python (test.py):

print("Hello There")

Java (test.java):

public class Test {
  public static void main(String[] args) {
    for(String value : args) {
      System.out.println(value);
    }
  }
}

In my command line I'm executing the following:

python test.py | java Test

I'm getting the following error:

BrokenPipeError: [Errno 32] Broken pipe

Can anyone explain why this is happening and what would be a good way of fixing it? Many thanks :)

decprog
  • 167
  • 2
  • 5
  • 22

0 Answers0