I am quite aware that this might be more of a Java/Python problem but it's on the RasPi and I also don't know if Java or Python is the problem.
So here is the situation:
I have a python script which is run by a Java Program with Runtime exec.
The two programs communicate quite simply with each other if the java Programm sends "go" the python script does something, once its done it returns "done"
while true:
raw_input('')
#do something
print('done')
Running this in command line works fine, it does just what its supposed to.
And the java program Opens input and output streams from the Process.
Process p = Runtime.getRuntime().exec("python test1.py "+number1+" "+number2);
BufferedReader in = new BufferedReader(new InputStreamReader(p.getInputStream()));
BufferedReader out = new BufferedReader(new OutputStreamReader(p.getOutputStream()));
So here is where it gets messy.
If I run this and check for the input stream to be ready, it won't be, it will never be ready so I can't read from it. If I remove the line raw_input('')
the input stream in Java will be readable but I just can't communicate with the script anymore.
I am pretty sure it's something very little which I just don't see! Thanks for the help :)