Closed RahulBadenkal closed 2 months ago
Looks like adding this env variable PYTHONUNBUFFERED = 1
makes stdout/stdin streams to be unbuffered. Reference
Adding -u
flag to request doesn't work as we need -u <file-name>
but in the api app the args are set the other way <file-name ...flags>
Reference
Possible to add PYTHONUNBUFFERED = 1
to the package env file of python?
https://github.com/engineer-man/piston/blob/master/packages/python/3.12.0/environment
For now, you can use print('1', flush=True)
. I think this should cause the output to appear immediately.
While what you mentioned works, it would be better if it was added as part of the env file so the user won't have be informed to set flush while executing code.
For now I have forked the repo and added a post build script that installs python package and updates the env file.
When i execute the below python program in socket mode (via
/connect)
The output all comes at once, rather than at 3 sec intervals