Hello!
I'm using py4j as a scripting layer for Java (for Minecraft modding). It's mostly working great with the exception that any Python code executed by py4j appears to have completely empty system output.
While I know it's likely a more common use case to start the JVM from Python, I'm building and starting the Python process with ProcessBuilder in the existing Java application because I don't want to change how every user starts the application, especially fellow developers who are less technically inclined. Here's a link to the code at
buildPyProcess(). I redirectHowever, "python.log" only gets the output from when the script I start Python with is imported.
To try and extract some kind of output from Python, I've tried adding code to manually flush the Python stdout to another file (at
invoke_file()). Each time the code is invoked, the "python_process.log" file simply adds a newline with no text otherwise (I assume this is the normal behavior of Python when appending an empty string to a file? I'm not the most experienced Python developer), implying that there isn't anything at
stdout.
To be clear, everything that isn't the standard output works as expected.
Also, is there a better way to do code formatting or markdown here?