I was trying to read utf-16 file. This code is working fine on local machine but when I ran it on AWS Batch service then it's giving above error.
import codecs
file_to_split = codecs.open("file_utf_16.txt", 'r+', "UTF-16")
It throws an exception header 'ascii' codec can't encode character '\ufeff' in position 0: ordinal not in range(128)
I am using Python 3.6.