openpyxl leaving file open after reading?

82 views
Skip to first unread message

raf

unread,
Jan 27, 2020, 7:24:07 PM1/27/20
to python...@googlegroups.com
hi,

i've just come to the conclusion that openpyxl, when
just reading an xlsx file, leaves it open when the
reading is complete. i found this out because a
subsequent attempt to rename the file on windows fails
(because some process has the file is open). when i
added an explicit workbook.close() method after
reading, the problem went away.

i'm using openpyxl-2.6.4 with python-2.7 and i assume
that the bug won't be fixed there but i didn't notice
any mention of it in the changelog for later, python-3
only versions of openpyxl, which may or may not exhibit
the same problem.

so, any openpyxl developers listening, you might want
to determine if this is a real bug in the latest
version and, if so, fix it. if this behaviour is
happening but isn't considered to be a bug, then please
improve the simple reading examples in the
documentation by including code to close the file after
reading so the behaviour doesn't surprise anyone else.

cheers,
raf

Reply all
Reply to author
Forward
0 new messages