On 07Jul2024 22:22, Rob Cliffe <rob.cliffe at btinternet.com> wrote: >it's legal, but doesn't work (trying to access the file after "with f" >raises the same > ValueError: I/O operation on closed file. Just to this: of course. The with closes the file. But my version runs the with after the try/except.