Description
Code Sample, a copy-pastable example if possible
import pandas
import psutil
proc = psutil.Process()
try:
data = pandas.read_csv('kek.csv', engine='python') # kek.csv is an empty file
except pandas.errors.EmptyDataError:
pass
print(proc.open_files())
Problem description
Hi, there might be an unwanted behavior on attempt to read an empty .csv
file, providing a
filename instead of handler, so it cannot be closed anymore by user on exception.
Expected Output
[]
Output of pd.show_versions()
INSTALLED VERSIONS
commit : None
python : 3.7.4.final.0
python-bits : 64
OS : Linux
OS-release : 4.14.13-1.el7.elrepo.x86_64
machine : x86_64
processor : x86_64
byteorder : little
LC_ALL : None
LANG : en_US.UTF-8
LOCALE : en_US.UTF-8
pandas : 1.0.0
numpy : 1.18.1
pytz : 2019.3
dateutil : 2.8.1
pip : 19.2.2
setuptools : 45.1.0
Cython : 0.29.14
pytest : 5.0.1
hypothesis : 4.32.2
sphinx : 2.1.2
blosc : None
feather : None
xlsxwriter : 1.1.8
lxml.etree : 4.4.1
html5lib : 1.0.1
pymysql : 0.9.2
psycopg2 : 2.8.3 (dt dec pq3 ext lo64)
jinja2 : 2.10.1
IPython : 7.8.0
pandas_datareader: None
bs4 : 4.8.0
bottleneck : 1.2.1
fastparquet : None
gcsfs : None
lxml.etree : 4.4.1
matplotlib : 3.1.1
numexpr : 2.7.1
odfpy : None
openpyxl : 2.6.2
pandas_gbq : None
pyarrow : 0.15.0
pytables : None
pytest : 5.0.1
pyxlsb : None
s3fs : None
scipy : 1.3.1
sqlalchemy : 1.3.7
tables : 3.5.2
tabulate : 0.8.3
xarray : 0.12.1
xlrd : 1.2.0
xlwt : 1.3.0
xlsxwriter : 1.1.8
numba : 0.45.1