[issue38868] Shutil cannot delete a folder that contains an .ini file
Svetlana Vodianova added the comment: I think eryksun is correct. I agree. The code sample provided by him, and the Python docs, mean I'm able to remove a folder with a .ini file without getting WinError 5. I should mark this as closed as he solved my problem. -- stage: -> resolved status: open -> closed ___ Python tracker <https://bugs.python.org/issue38868> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue38868] Shutil cannot delete a folder that contains an .ini file
Svetlana Vodianova added the comment: What is the system error code (winerror) of the PermissionError? PermissionError: [WinError 5] Access is denied Note: Please ignore my first post (msg357097) describing the problem, I made a few mistakes that might be confusing. msg357099 better describes my problem. -- ___ Python tracker <https://bugs.python.org/issue38868> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue38868] Shutil cannot delete a folder that contains an .ini file
Svetlana Vodianova added the comment: I posted my problem on Stack Overflow, but as of right now haven't received any answers. Link: https://stackoverflow.com/questions/58922332/shutil-cannot-delete-a-folder-with-a-hidden-desktop-ini-file To summarize my problem: If you use copytree to copy a source folder that contains a desktop.ini file to a destination, and then call rmtree() to remove the destination folder (for example after zipping, you may want to remove the uncompressed destination folder), it will throw an error indicating it doesn't have permission to remove the folder. Using ignore_patterns() doesn't help either, or to quote my problem on SO: It seems once the source contains a .ini file, even if it isn't copied to the destination, rmtree() will have a problem removing the destination folder. Powershell has almost the same issue, however, unlike Python, if you tell PS to ignore the .ini file, it will remove the folder without crashing. rmtree has no problem removing folders containing 0 ini files. -- ___ Python tracker <https://bugs.python.org/issue38868> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue38868] Shutil cannot delete a folder that contains an .ini file
New submission from Svetlana Vodianova : I posted my problem on Stack Overflow, but as of right now haven't received any answers. Link: https://stackoverflow.com/questions/58922332/shutil-cannot-delete-a-folder-with-a-hidden-desktop-ini-file To summarize my problem: If you use copytree to copy a source folder that contains a desktop.ini file to a destination, and then call rmtree() to remove the source folder, it will throw an error indicating it doesn't have permission to remove the folder. Using ignore_patterns() doesn't help either, or to quote my problem on SO: It seems once the source contains a .ini file, even if it isn't copied to the destination, rmtree() will have a problem removing the source folder. Powershell has almost the same issue, however, unlike Python, if you tell PS to ignore the .ini file, it will remove the folder without crashing. rmtree has no problem removing folders containing 0 ini files. -- components: IO, Windows messages: 357097 nosy: QueenSvetlana, paul.moore, steve.dower, tim.golden, zach.ware priority: normal severity: normal status: open title: Shutil cannot delete a folder that contains an .ini file type: crash versions: Python 3.8 ___ Python tracker <https://bugs.python.org/issue38868> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com