Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
dustmop opened this issue Dec 20, 2021 · 0 comments
Assignees

Comments

@dustmop
Copy link
Contributor

dustmop commented Dec 20, 2021

  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?)
@dustmop dustmop self-assigned this Dec 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant