🐍
Github ActionsのWindows環境でtempfile.NamedTemporaryFileがパーミッションエラー
表隊の通り以下のようなテストコードを書いた際に Github Actions の Windows 環境で Permission Error になってしまう。
with tempfile.NamedTemporaryFile() as f:
...
解決策としては削除処理を自前でしてあげると回避できる。
tmp = tempfile.NamedTemporaryFile()
...
tmp.close()
os.unlink(tmp.name) # os.removeでもおそらくOK
何回かハマったのでメモしておく。
Discussion