Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork938
Open
Description
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
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)