79139681

Date: 2024-10-30 04:53:14
Score: 0.5
Natty:
Report link

At first glance, the "UTF-16 stream does not start with BOM" exception suggests that you are opening the file using the wrong encoding. Since I do not have the file on hand, I cannot advise you on which format the csv files are encoded in. I recommend removing the encoding parameter from your open calls, or determining the correct encoding of the files.

Maybe use the simplified snippet below to verify you can open the files.

import glob

files = glob.glob('C:/Users/Downloads/*.csv')
for file in files:
      lines = open(file).readlines()
      print(lines)

Helpful reference of the error you are seeing: UnicodeError: UTF-16 stream does not start with BOM

Reasons:
  • Blacklisted phrase (0.5): I cannot
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Low reputation (1):
Posted by: ALearningCurve