[issue35969] Interpreter crashes with "can't initialize init_sys_streams" when abc fails to import

STINNER Victor report at bugs.python.org
Tue Feb 12 05:57:04 EST 2019


STINNER Victor <vstinner at redhat.com> added the comment:

A workaround is the usage of -I option:

vstinner at apu$ PYTHONPATH=: python3 -c ""
Fatal Python error: init_sys_streams: can't initialize sys standard streams
Traceback (most recent call last):
  File "/usr/lib64/python3.7/io.py", line 52, in <module>
  File "/tmp/demo/abc.py", line 1, in <module>
Exception: Hi
Aborted (core dumped)

vstinner at apu$ PYTHONPATH=: python3 -I -c ""
<it works as expected>

A long term solution would to enable -I behavior by default: don't add the current directory to sys.path when using -c CMD.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue35969>
_______________________________________


More information about the Python-bugs-list mailing list