I am trying to get the source code of a python script. that is, I would like to be able to run:
$ source <(python example.py)
It ALWAYS fails with the same problem:
Exception ignored in: <_io.TextIOWrapper name='<stdout>' mode='w' encoding='UTF-8'>
BrokenPipeError: [Errno 32] Broken pipe
Here is an .py example:
print("export ENV_VAR=abc")
Is there any way around this? I tried to try the exception (BrokenPipeError), but it does not seem to work. The exception seems to prevent the source from working with
$ echo $ENV_VAR
gives nothing
source
share