R. David Murray added the comment:
The error message is correct: your example is invalid python code. Try
it in a file and you will get the same error message. Check the
documentation of the '-c' option to learn how to correctly code your
example.
--
nosy: +r.david.murray
resolution:
New submission from Kandalintsev Alexandre :
Hello!
I found this problem:
$ python3 -c 'import sys; for line in sys.stdout: pass'
File "", line 1
import sys; for line in sys.stdout: pass
^
SyntaxError: invalid syntax
Without import-statement this work great. Also code '