Description
-
I have checked that this issue has not already been reported.
-
I have confirmed this bug exists on the latest version of pandas.
-
I have confirmed this bug exists on the master branch of pandas.
Reproducible Example
import os
import pandas
import tempfile
import traceback
with tempfile.SpooledTemporaryFile() as f:
f.write(b'abcd')
f.seek(0)
try:
result = pandas.read_csv(f)
print(result)
except Exception as e:
print(e)
print(traceback.format_exc())
Issue Description
This worked in pandas 1.1.5 but is no longer working in version >=1.2.0.
Expected Behavior
According to the read_csv
description I would expect this to work.
filepath_or_bufferstr, path object or file-like object
Any valid string path is acceptable. The string could be a URL. Valid URL schemes include http, ftp, s3, gs, and file. For file URLs, a host is expected. A local file could be: file://localhost/path/to/table.csv.
If you want to pass in a path object, pandas accepts any os.PathLike.
By file-like object, we refer to objects with a read() method, such as a file handle (e.g. via builtin open function) or StringIO.
Installed Versions
pandas : 1.3.2
numpy : 1.21.2
pytz : 2021.1
dateutil : 2.8.2
pip : 20.1.1
setuptools : 47.1.0
IPython : 7.27.0