1

I've been tinkering with the os module for a few days encountered this error. Can't seem to fix it. Here is an example:

import os


os.chdir('C:\\Users\\User\\Desktop')

os.rename('odin', 'ddin')

print (os.listdir())

And this is the error:

PermissionError: [WinError 5] Access is denied: 'odin' -> 'ddin'

Any help?

Shell1500
  • 330
  • 1
  • 5
  • 14
  • Possible duplicate of [PermissionError: \[WinError 5\] Access is denied python using moviepy to write gif](https://stackoverflow.com/questions/26091530/permissionerror-winerror-5-access-is-denied-python-using-moviepy-to-write-gif) – thirdDeveloper Jul 15 '18 at 10:13

2 Answers2

0

you are running your python program from an user that does not have permissions to change the specific file name ' try running from another user or change the file permissions to allow writing to your user.

ddor254
  • 1,570
  • 1
  • 12
  • 28
0

First, try running the same program in IDLE with administrator privileges. Second, There is chance that your anti-virus software is blocking your python script so try disabling antivirus.