[bug] access denied while renaming unzipped folders
See original GitHub issueThis issue is the same than https://github.com/conan-io/conan/issues/5205
Environment Details (include every applicable attribute)
- Operating System+version: Windows 10
- Conan version: 1.22.2
- Python version: 3.5.4
- Windows indexing is disabled for .conan folder
Steps to reproduce (Include if Applicable)
- run
conan create
orconan install
such a way it has to build from source. - use recipe and version where source code is a big package (in size or number of files), for me it happens all the time with physx and cspice (waiting merge in conan-center-index), sometimes with qt or boost, and with different computers (but always on Windows 10).
Logs (Executed commands with output) (Include/Attach if Applicable)
ERROR: physx/4.1.1: Error in source() method, line 80
os.rename(extracted_dir, self._source_subfolder)
PermissionError: [WinError 5] Access denied: 'PhysX-ae80dede0546d652040ae6260a810e53e20a06fa' -> 'source_subfolder'
Adding a try / except + sleep few seconds is a workaround, since this permission denied seems to be ephemeral, or a loop with few retries.
It would be nice if conan could provide a tools.rename in order to handle these kinds of issues on Windows.
Issue Analytics
- State:
- Created 4 years ago
- Comments:15 (13 by maintainers)
Top Results From Across the Web
Windows 10 "Access Denied" Folder Errors: 5 Easy Fixes
Here's how to do this. First, right-click the folder or file in question and select Properties. On the resulting window, switch to the...
Read more >Getting Access Denied Error When Trying To Rename A File.
Step 1: Right-click on the file or folder you want to take ownership of and click on Properties > Security tab. Step 2:...
Read more >Access is Denied When Renaming Folder - Stack Overflow
This utility will show all the open handles on the system and which process is using them. One of them may have a...
Read more >Destination Folder Access Denied in Windows 10/8/7 [Fixed]
Top 5 Ways to Fix Destination Folder Access Denied in Windows 10/8/7 · Fix 1. Grant Full Control to the Folder by Changing...
Read more >Access Denied when Renaming File/Folder - Computer Hope
Sometimes when I try to rename a folder, I got an error of: Access is denied. Make sure the disk is not full...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
In another context I’ve observed the permission denied error and there I’ve tried to isolate the problem. With the following python script I was able to produce the error nearly 100%:
=> So my conclusion so far is that maybe the file operations (before the call to
os.rename()
) return already before the file handle is released (async.).As a workaround I’ve implemented a retry loop with waiting 500 ms between retries:
I’ve checked again a conan create with physx and antivirus disabled (on my personnal computer, can’t do that on corporate desktop), I don’t have permission denied error in this case.