-
Notifications
You must be signed in to change notification settings - Fork 14
Open
Description
If some script change sys.stdout
, sys.stderr
, sys.stdin
on runtime, there are no reset to original ones on second and future scripts executions. All next executions will use redefined IO, in some cases it won't print nothing. The only way to fix it is reload sys
module or restart the app.
Is there way to setup force sys/interpreter/environment
reset on next script execution? For now I can avoid it just with adding shortcut to the script with reset environment
flag
This behaviour can be represented with this small snippets
Run script1.py
and then script2.py
# script1.py
import sys
class FakeStream:
def write(self, s, no_wait=False):
pass # assume this stream have no output
print("sample text 1") # output: sample text 1
sys.stdout = FakeStream()
print("sample text 2") # No output there
# script2.py
print("sample text 3") # No more output there till `sys` reload or Pythonista restart
P.S.: For example it happen every time the StaSh
launched. It overwrites sys and then neither ansi escape codes will work in the console
omz
Metadata
Metadata
Assignees
Labels
No labels