I use the next code:

    with NamedTemporaryFile(delete=False) as tmp:

Without the flag ‘delete=False’ it has worked before, but now I get the error message ‘permission denied’ with
I had to add the flag ‘delete=False’ to make it work again.
I saw there is a difference between running in Windows versus Unix.
I develop now with VENV, and I think de app then runs on my laptop in Windows.

Is adding the flag a nice solution? The temp file isn’t deleted.
And does this work after publishing the app (runs in Unix?)?

Hi Rino, this seems to be an issue on Windows indeed. I see multiple topics regarding this behavior, for example:

Using delete=False is the way to go, but you are advised to manually clean up the temp file using os.unlink for example.