-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
ERR: read_csv exposes an internal function when bad argument is specified #25648
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
Labels
Error Reporting
Incorrect or improved errors from pandas
IO CSV
read_csv, to_csv
Needs Discussion
Requires discussion from core team before further action
Milestone
Comments
These IO functions are built dynamically: Line 704 in f886139
Personally not sure how the traceback is built but certainly welcome to take a look. Maybe should be using |
Not sure there is an easy way to do this - that error message seems to be using the code object name, which can't be modified In [24]: def orig_func(a):
...: return a
In [25]: new_func = orig_func
new_func.__name__ = 'new_func'
new_func.__qualname__ = 'new_func'
In [26]: new_func(b=2)
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-26-4e081338f0ff> in <module>()
----> 1 new_func(b=2)
TypeError: orig_func() got an unexpected keyword argument 'b'
In [27]: new_func.__code__.co_name
Out[27]: 'orig_func'
In [28]: new_func.__code__.co_name = 'new_func'
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-28-89626da5926c> in <module>()
----> 1 new_func.__code__.co_name = 'new_func'
AttributeError: readonly attribute |
5 tasks
This needs further discussion, see #33023 |
5 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Error Reporting
Incorrect or improved errors from pandas
IO CSV
read_csv, to_csv
Needs Discussion
Requires discussion from core team before further action
When a user tries to specify a non-existent argument in
read_csv
the error message pertains to what seems to be an internal function (parser_f
). This behavior might be a bit surprising / confusing to users, who would expect the error message to refer to the function actually being used.yields
The text was updated successfully, but these errors were encountered: