qri-io / qri

you're invited to a data party!
https://qri.io
GNU General Public License v3.0
1.11k stars 66 forks source link

feat suggestion: transform error message due to trailing comma can be improved #2000

Open dustmop opened 2 years ago

dustmop commented 2 years ago
  df = dataframe.DataFrame([["cat", datetime.datetime(year=2021, month=1, day=23)],
                            ["cat", datetime.datetime(year=2021, month=5, day=19)]
                            ["dog", datetime.datetime(year=2021, month=7, day=4)]],
                           columns=["animal","when"])

This code is missing a comma at the end of the second line. This leads to the following error message:

Traceback (most recent call last):
  .star:25:2: in <toplevel>
  .star:7:29: in f
Error: list index: got tuple, want int

We can detect this situation, and wrap the error so it displays this:

Error: list index: got tuple, want int (did you miss a trailing comma?)