-
-
Notifications
You must be signed in to change notification settings - Fork 18.2k
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
API: Raise FileNotFoundError in read_csv #14116
API: Raise FileNotFoundError in read_csv #14116
Conversation
Current coverage is 85.27% (diff: 66.66%)@@ master #14116 diff @@
==========================================
Files 139 139
Lines 50543 50545 +2
Methods 0 0
Messages 0 0
Branches 0 0
==========================================
+ Hits 43101 43103 +2
Misses 7442 7442
Partials 0 0
|
Looks good to me. Would be nice to also look if other readers raise IOError currently. |
f3dcf40
to
a485594
Compare
@jorisvandenbossche : |
I think this also exists for json / excel. |
@jreback : They give different errors, at least when I tried locally. |
@gfyoung can you elaborate? |
@jreback : Sorry, wasn't clear. >>> read_json('nonexistent.json')
...
ValueError: Unexpected character found when decoding 'null' I suppose that could be improved but seems a little different from what I'm fixing here. |
ok, yes this should be ok for all other things. can you quickly see if read_stat/read_sas are ok? (I think things that call ping if ok |
@@ -439,6 +439,7 @@ API changes | |||
- ``Timestamp.to_pydatetime`` will issue a ``UserWarning`` when ``warn=True``, and the instance has a non-zero number of nanoseconds (:issue:`14101`) | |||
- ``Panel.to_sparse`` will raise a ``NotImplementedError`` exception when called (:issue:`13778`) | |||
- ``Index.reshape`` will raise a ``NotImplementedError`` exception when called (:issue:`12882`) | |||
- ``pd.read_csv()``, ``pd.read_table()``, and ``pd.read_hdf()`` raise a ``FileNotFoundError`` exception for Python >= 3.3 when called on a nonexistent file (:issue:`14086`) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
update this to say that this is the standard for file not found and is back-compat to OSError.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, done.
For a nonexistent file, raise the more specific FileNotFoundError for Python >= 3.3 in read_csv, read_table, and read_hdf. This error is backported to Python 2.x as IOError. Closes pandas-devgh-14086.
a485594
to
4923f73
Compare
Looks good to me! |
@jreback : Travis is passing. Ready to merge if there are no other concerns. |
For a nonexistent file, raise the more specific
FileNotFoundError
for Python >= 3.3 inread_csv
.Closes #14086.