I got the following error: TypeError: input() got an unexpected keyword argument 'encoding' when trying to read from stdin in python using fileinput.input(), but the documentation says file input should be used like that.
I’m using python 3.9
import fileinput
for line in fileinput.input(encoding="utf-8"):
process(line)
>Solution :
In Python 3.9, fileinput.input() does not take an encoding argument (see here). That argument was introduced in Python 3.10:
Changed in version 3.10: The keyword-only parameter encoding and errors are added.