PermissionError: [Errno 13] Permission denied: '/path'
The OS refused the file operation — no permission, a directory passed to open(), or (on Windows) the file is open elsewhere.
[Errno 13] Permission denied Meaning
On Linux the Python process user lacks rights. On Windows, Excel or another program locking the file also raises Errno 13. Opening a directory path with open() raises it too.
Common causes
- Process user lacks read/write permission
- Path is a directory, not a file
- File locked by another program (Windows)
- Writing into a system or site-packages directory without a venv
⚡ Quick fix
- Check ownership/permissions with ls -l
- Make sure the path points to a file
- Close the file in other programs
- Use a virtual environment instead of sudo pip
Detailed fix by platform
Linux
sudo chown -R $USER:$USER ./output
How to diagnose
- Path — File or directory?
- User — Which user runs Python?
- Lock — Open in another app?
🔧 Still not fixed?
Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:
Similar errors
Most viewed in Python
Other ways to find it
Where this error sits
Origin: Application & API. Errors that are often confused with or caused by this one (click to open):
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
💬 What worked for others
No tips yet — did something else fix this for you?
Share what worked for you
Tips are checked by an editor before they appear. Links are removed.
Report a correction or suggest an improvement
Last updated 13 Oct 2026