wireservice / csvkit

A suite of utilities for converting to and working with CSV, the king of tabular file formats.
https://csvkit.readthedocs.io
MIT License
6.03k stars 603 forks source link

csvclean IndexError: list index out of range #1164

Closed kintaro1981 closed 2 years ago

kintaro1981 commented 2 years ago

I'm trying to use csvclean but I'm getting: IndexError: list index out of range

In which cases can happen? The CSV have come carriage returns in some rows in a specific column anche I was hoping that csvclean fix those.

csvclean -v -n test.csv

Traceback (most recent call last):
  File "/usr/bin/csvclean", line 11, in <module>
    load_entry_point('csvkit', 'console_scripts', 'csvclean')()
  File "/home/nginx/domains/domain.com/public/test/src/csvkit/csvkit/utilities/csvclean.py", line 90, in launch_new_instance
    utility.run()
  File "/home/nginx/domains/domain.com/public/test/src/csvkit/csvkit/cli.py", line 118, in run
    self.main()
  File "/home/nginx/domains/domain.com/public/test/src/csvkit/csvkit/utilities/csvclean.py", line 30, in main
    for row in checker.checked_rows():
  File "/home/nginx/domains/domain.com/public/test/src/csvkit/csvkit/cleanup.py", line 66, in checked_rows
    fixed_row = join_rows([error.row for error in joinable_row_errors], joiner=' ')
  File "/home/nginx/domains/domain.com/public/test/src/csvkit/csvkit/cleanup.py", line 18, in join_rows
    fixed_row[-1] += "%s%s" % (joiner, row[0])
IndexError: list index out of range
kintaro1981 commented 2 years ago

ok, my fault.

csvclean -d ";" -v -n test.csv

is not giving error anymore, but the carriage returns are still there, I'm going to investigate more.