We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ad2e98c commit 7c7b7e0Copy full SHA for 7c7b7e0
pandas/io/packers.py
@@ -176,14 +176,8 @@ def read(fh):
176
177
# see if we have an actual file
178
if isinstance(path_or_buf, str):
179
- try:
180
- exists = os.path.exists(path_or_buf)
181
- except (TypeError, ValueError):
182
- exists = False
183
-
184
- if exists:
185
- with open(path_or_buf, 'rb') as fh:
186
- return read(fh)
+ with open(path_or_buf, 'rb') as fh:
+ return read(fh)
187
188
if isinstance(path_or_buf, bytes):
189
# treat as a binary-like
pandas/tests/io/test_common.py
@@ -140,7 +140,7 @@ def test_iterator(self):
140
(pd.read_stata, 'os', FileNotFoundError, 'dta'),
141
(pd.read_sas, 'os', FileNotFoundError, 'sas7bdat'),
142
(pd.read_json, 'os', ValueError, 'json'),
143
- (pd.read_msgpack, 'os', ValueError, 'mp'),
+ (pd.read_msgpack, 'os', FileNotFoundError, 'mp'),
144
(pd.read_pickle, 'os', FileNotFoundError, 'pickle'),
145
])
146
def test_read_non_existant(self, reader, module, error_class, fn_ext):
@@ -169,7 +169,7 @@ def test_read_non_existant(self, reader, module, error_class, fn_ext):
169
170
171
172
173
174
175
def test_read_expands_user_home_dir(self, reader, module,
0 commit comments