Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

git.repo.base.repo.tree() blocks deletion of repo directory on Windows (fine in Linux) #546

Open
@altendky

Description

@altendky

I am checking out repositories into a temporary directory, doing various things with them including callingtree(), and then deleting the directories and the temporary directory. This works fine in Linux but not in Windows. I have created this SSCCE to show the issue. I will take some time right now to try to attempt to fix it myself but I like to document my issues first (so others know and just in case someone else sees it and has insight).

Note that I am making an effort (del_rw()) to clear read-only items.

I am testing on:

  • Windows 10 Enterprise 64-bit (in VirtualBox)
  • Python 3.5.2 32-bit

t.py.txt

Output:

(venv)C:\Users\IEUser\Desktop\407>pythont.pyTraceback (mostrecentcalllast):File"C:\Users\IEUser\Desktop\407\venv\lib\shutil.py",line381,in_rmtree_unsafeos.unlink(fullname)PermissionError: [WinError5]Accessisdenied:'C:\\Users\\IEUser\\AppData\\Local\\Temp\\tmprbrn0gen\\tree\\.git\\objects\\pack\\pack-986f782a1c797b94e8a9fa75402bf81fbbc4d537.idx'Duringhandlingoftheaboveexception,anotherexceptionoccurred:Traceback (mostrecentcalllast):File"t.py",line40,in<module>shutil.rmtree(dir,onerror=del_rw)File"C:\Users\IEUser\Desktop\407\venv\lib\shutil.py",line488,inrmtreereturn_rmtree_unsafe(path,onerror)File"C:\Users\IEUser\Desktop\407\venv\lib\shutil.py",line378,in_rmtree_unsafe_rmtree_unsafe(fullname,onerror)File"C:\Users\IEUser\Desktop\407\venv\lib\shutil.py",line378,in_rmtree_unsafe_rmtree_unsafe(fullname,onerror)File"C:\Users\IEUser\Desktop\407\venv\lib\shutil.py",line378,in_rmtree_unsafe_rmtree_unsafe(fullname,onerror)File"C:\Users\IEUser\Desktop\407\venv\lib\shutil.py",line383,in_rmtree_unsafeonerror(os.unlink,fullname,sys.exc_info())File"t.py",line19,indel_rwos.remove(name)PermissionError: [WinError5]Accessisdenied:'C:\\Users\\IEUser\\AppData\\Local\\Temp\\tmprbrn0gen\\tree\\.git\\objects\\pack\\pack-986f782a1c797b94e8a9fa75402bf81fbbc4d537.idx'Duringhandlingoftheaboveexception,anotherexceptionoccurred:Traceback (mostrecentcalllast):File"t.py",line40,in<module>shutil.rmtree(dir,onerror=del_rw)File"C:\Users\IEUser\Desktop\407\venv\lib\tempfile.py",line808,in__exit__self.cleanup()File"C:\Users\IEUser\Desktop\407\venv\lib\tempfile.py",line812,incleanup_shutil.rmtree(self.name)File"C:\Users\IEUser\Desktop\407\venv\lib\shutil.py",line488,inrmtreereturn_rmtree_unsafe(path,onerror)File"C:\Users\IEUser\Desktop\407\venv\lib\shutil.py",line378,in_rmtree_unsafe_rmtree_unsafe(fullname,onerror)File"C:\Users\IEUser\Desktop\407\venv\lib\shutil.py",line378,in_rmtree_unsafe_rmtree_unsafe(fullname,onerror)File"C:\Users\IEUser\Desktop\407\venv\lib\shutil.py",line378,in_rmtree_unsafe_rmtree_unsafe(fullname,onerror)File"C:\Users\IEUser\Desktop\407\venv\lib\shutil.py",line378,in_rmtree_unsafe_rmtree_unsafe(fullname,onerror)File"C:\Users\IEUser\Desktop\407\venv\lib\shutil.py",line383,in_rmtree_unsafeonerror(os.unlink,fullname,sys.exc_info())File"C:\Users\IEUser\Desktop\407\venv\lib\shutil.py",line381,in_rmtree_unsafeos.unlink(fullname)PermissionError: [WinError5]Accessisdenied:'C:\\Users\\IEUser\\AppData\\Local\\Temp\\tmprbrn0gen\\tree\\.git\\objects\\pack\\pack-986f782a1c797b94e8a9fa75402bf81fbbc4d537.idx'Theaboveexceptionwasthedirectcauseofthefollowingexception:Traceback (mostrecentcalllast):File"t.py",line42,in<module>raisePermissionError('Failed with tree (GitPython {})'.format(gitpython_hash))fromePermissionError:Failedwithtree (GitPython5149c807ec5f396c1114851ffbd0f88d65d4c84f)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp