[racket-users] Re: Output out of order when using system procedure

2020-05-20 Thread Rock Nie
This only happens in DrRacket. On Wednesday, May 20, 2020 at 1:16:44 PM UTC+8, Rock Nie wrote: > > I am running the system procedure in drracket's interactive window > (system "test.py") > > where test.py is > #!/home/utils/Python-3.8.0/bin/python3 > import os > > print("Running cmd: date1") > pri

[racket-users] Re: Output out of order when using system procedure

2020-05-20 Thread Alex Harsanyi
Short version: Try adding a "sys.stdout.flush()" after each of your print statements in your python script. Longer version: when you run that program in a terminal, the output is a TTY and the standard output is flushed after every line. When you run it as a subprocess, the standard output is

[racket-users] Re: Output out of order when using system procedure

2020-05-20 Thread Rock Nie
Thx! sys.stdout.flush() works but in real use cases I cannot add sys.stdout.flush() to every python print. Can I do anything in the racket side to solve the problem? Making the interactive window behave like terminal perhaps? On Wednesday, May 20, 2020 at 4:49:30 PM UTC+8, Alex Harsanyi wrote: >

[racket-users] Re: Output out of order when using system procedure

2020-05-20 Thread Alex Harsanyi
Change the first line of your python script to: #!/home/utils/Python-3.8.0/bin/python3 -u Alex. On Wednesday, May 20, 2020 at 5:00:12 PM UTC+8, Rock Nie wrote: > > Thx! sys.stdout.flush() works but in real use cases I cannot add > sys.stdout.flush() to every python print. > Can I do anythi