Hack Forums
[Python] Stupid python error for simple program (permission) HELP - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151)
+---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118)
+---- Thread: [Python] Stupid python error for simple program (permission) HELP (/showthread.php?tid=5782177)



Stupid python error for simple program (permission) HELP - kone2148 - Jan 9, 2018

Im having this problem with python , where it gives me the error:

PermissionError: [WinError 5] Access is denied: 'C:\\Users\\Daniel\\Desktop\\Patch-Keygen'

for a code as simple as :
import sys
import random
import os
import string
import time

os.remove('C:\\Users\\Daniel\\Desktop\\Patch-Keygen')


Ive also tried running it as administrator (both PyCharm and python.exe) and nothing seems to work?

Any ideas on what i should do/am doing wrong? Thanks in advance


RE: Stupid python error for simple program (permission) HELP - Kiksen - Jan 9, 2018

I asume it is a folder with content you are trying to remove.

You can fix it with.

Code
import shutil

shutil.rmtree('/folder_name')

https://stackoverflow.com/questions/303200/how-do-i-remove-delete-a-folder-that-is-not-empty-with-python


RE: Stupid python error for simple program (permission) HELP - kone2148 - Jan 9, 2018

Thank you so much this helped a bunch! i already love these forums :D

(now i can make my malicious programs B| )