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

I/O operation on closed file when opening a file twice #70

Open
raffaeler opened this issue Dec 29, 2024 · 0 comments
Open

I/O operation on closed file when opening a file twice #70

raffaeler opened this issue Dec 29, 2024 · 0 comments

Comments

@raffaeler
Copy link

I have to open a xlsx file twice in order to get both the cell values and the formulas definitions:

wb_data = openpyxl.load_workbook(xlsx_file, keep_vba=True, data_only=True)
wb_form = openpyxl.load_workbook(xlsx_file, keep_vba=True, data_only=False)

wb_data.close()
wb_form.close()

The above code produces the following exception:

Exception ignored in: <function ZipFile.__del__ at 0x00000284EDD7E480>
Traceback (most recent call last):
  File "C:\Users\XXXX\AppData\Local\Programs\Python\Python313\Lib\zipfile\__init__.py", line 1975, in __del__
    self.close()
  File "C:\Users\XXXX\AppData\Local\Programs\Python\Python313\Lib\zipfile\__init__.py", line 1992, in close
    self.fp.seek(self.start_dir)
ValueError: I/O operation on closed file.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant