Skip to content

Reading csv file error in Python 3. #51

@skliper

Description

@skliper

Reading csv file should use open(filename, 'r', newline='') in Python 3.

Otherwise it will raise up:

>>> with open('cs-hk-tlm.txt', 'rb') as f:
...  reader = csv.reader(f)
...  for r in reader:
...   print(r)
... 
Traceback (most recent call last):
  File "<stdin>", line 3, in <module>
_csv.Error: iterator should return strings, not bytes (did you open the file in text mode?)

This didn't address in de8c151.

Originally posted by @mlouielu in #35 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    invalidThis doesn't seem right

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions