Skip to content
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

BUG: corrupted SAS datasets retain file handles #35566

Closed
2 of 3 tasks
rxxg opened this issue Aug 5, 2020 · 0 comments · Fixed by #35587
Closed
2 of 3 tasks

BUG: corrupted SAS datasets retain file handles #35566

rxxg opened this issue Aug 5, 2020 · 0 comments · Fixed by #35587
Labels
Bug Error Reporting Incorrect or improved errors from pandas IO SAS SAS: read_sas
Milestone

Comments

@rxxg
Copy link
Contributor

rxxg commented Aug 5, 2020

  • I have checked that this issue has not already been reported.

  • I have confirmed this bug exists on the latest version of pandas.

  • (optional) I have confirmed this bug exists on the master branch of pandas.


Note: Please read this guide detailing how to provide the necessary information for us to reproduce your bug.

Code Sample, a copy-pastable example

import pandas as pd
from pathlib import Path

path = ...
p = Path(path, 'corrupt.sas7bdat')
try:
    pd.read_sas(p)
except:
    input("Press enter to release file")

Problem description

When I run the above script with a corrupt database like the one attached corrupt.zip the Python process my Windows system ends up holding on to the open file.

I can tell that the file has not been correctly closed on error since, for example, other processes cannot open the same file.

Expected Output

While the main Python process is waiting for input, other processes should be able to read the given file.

I can't find any way of finding out if the current Python process has an open file handle on a given file, but it is expected behaviour that other processes should be able to access the file before

Output of pd.show_versions()

INSTALLED VERSIONS

commit : d9fff27
python : 3.7.1.final.0
python-bits : 64
OS : Windows
OS-release : 10
Version : 10.0.17763
machine : AMD64
processor : Intel64 Family 6 Model 142 Stepping 9, GenuineIntel
byteorder : little
LC_ALL : None
LANG : None
LOCALE : None.None
pandas : 1.1.0
numpy : 1.18.1
pytz : 2019.3
dateutil : 2.8.1
pip : 10.0.1
setuptools : 39.0.1
Cython : None
pytest : None
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : None
lxml.etree : None
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : None
IPython : None
pandas_datareader: None
bs4 : None
bottleneck : None
fsspec : None
fastparquet : None
gcsfs : None
matplotlib : None
numexpr : None
odfpy : None
openpyxl : 3.0.3
pandas_gbq : None
pyarrow : None
pytables : None
pyxlsb : None
s3fs : None
scipy : 1.4.1
sqlalchemy : None
tables : None
tabulate : None
xarray : None
xlrd : 1.2.0
xlwt : 1.3.0
numba : None

@rxxg rxxg added Bug Needs Triage Issue that has not been reviewed by a pandas team member labels Aug 5, 2020
@jreback jreback added this to the 1.2 milestone Aug 6, 2020
@jreback jreback added IO SAS SAS: read_sas Error Reporting Incorrect or improved errors from pandas and removed Needs Triage Issue that has not been reviewed by a pandas team member labels Aug 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Error Reporting Incorrect or improved errors from pandas IO SAS SAS: read_sas
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants