E_J E_J - 14 days ago 4
Python Question

subprocess permission denied

I was looking into how python can start other programs on windows 10, I was on stack overflow and someone said that:

import subprocess
subprocess.call(['C:\\Users\Edvin\Desktop', 'C:\\Example.txt'])

should do it, so I changed the locations so it is specific to me and there was an error which was
PermissionError: [WinError 5] Access is denied

Does anyone know how to grant permission for python to open the file?

I've tried:

import subprocess
'\\Start Menu\\Programs\\Accessories\\Notepad.exe'],

but this comes up with
TypeError: bufsize must be an integer


The thing is that you're trying to launch your desktop as a program. With a text file as an argument.

This is not allowed because you're not allowed to execute the desktop (because it can't be executed).

subprocess.call(["command here", "arguments here"])

if it's an exe use

subprocess.call(['C:\\...\\program.exe', 'argument'])

if it's a python script use