3

Windows 7で実行している次のPython関数があります。

def update():
    temp_dir = tempfile.mkdtemp()
    git.Git().clone('my_repo', temp_dir)
    try:
        repo = git.Repo(temp_dir)
        repo.index.add('*')
        repo.index.commit('Empty commit')
    finally:
        from git.util import rmtree
        rmtree(temp_dir)

残念ながら、rmtree 行では次のようになります。

WindowsError: [Error 32] The process cannot access the file because it is being used by another process: 'c:\\users\\myaccount\\appdata\\local\\temp\\tmpdega8h\\.git\\objects\\pack\\pack-0ea07d13498ab92388dc33fbabaadf37511623c1.idx'

Windows で一時ディレクトリを削除するにはどうすればよいですか?

4

1 に答える 1