I am trying to parse gzip files line by line :
with gzip.open(obj.get()['Body'])as f:
for line in f:
line=StringIO(line.decode("utf-8"))
line=csv.reader(line,delimiter=',')
for line1 in line:
#some logic
But for some of the files I have error:
new-line character seen in unquoted field - do you need to open the file in universal-newline mode?
When I try to open in newlline mode:
csv.reader(open(line, 'rU'), delimiter=',')
I have:
expected str, bytes or os.PathLike object, not _io.StringIO
I want all fields, which contain '\r' to be in that field as part of string value. How this can be resolved?