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
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
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:
>
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
4 matches
Mail list logo