jeudi 9 avril 2015

Why can't I delete a directory created in ProgramData?

I' trying to create a directory and then delete it (for testing purposes, which I will ommit, but can give details if needed).


Like this:



>>> import os
>>> os.makedirs('C:\\ProgramData\\dir\\test')
>>> os.remove('C:\\ProgramData\\dir\\test')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
PermissionError: [WinError 5] Access is denied: 'C:\\ProgramData\\dir\\test'


I always get access denied, although I'm running the interpreter as an admin. Also I have no problem manually deleting the directory.


Aucun commentaire:

Enregistrer un commentaire