WindowsError [error 5] Access is denied

I solved a similar problem I had by switching to the process directory (I was trying to use inkscape) and it solved my problem import subprocess inkscape_dir=r”C:\Program Files (x86)\Inkscape” assert os.path.isdir(inkscape_dir) os.chdir(inkscape_dir) subprocess.Popen([‘inkscape.exe’,”-f”,fname,”-e”,fname_png]) Maybe switching to the process directory will work for you too.

Can’t remove a folder with os.remove (WindowsError: [Error 5] Access is denied: ‘c:/temp/New Folder’)

os.remove requires a file path, and raises OSError if path is a directory. Try os.rmdir(folder+’New Folder’) Which will: Remove (delete) the directory path. Only works when the directory is empty, otherwise, OSError is raised. Making paths is also safer using os.path.join: os.path.join(“c:\\”, “temp”, “new folder”)