subprocess permission denied
<p>I was looking into how python can start other programs on windows 10, I was on stack overflow and someone said that:</p>

<pre><code>import subprocess
subprocess.call(['C:\\Users\Edvin\Desktop', 'C:\\Example.txt'])
</code></pre>

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

<p>Does anyone know how to grant permission for python to open the file?</p>

<p>I've tried:</p>

<pre><code>import subprocess
subprocess.call(['C:\\Users\\Edvin\\AppData\\Roaming\\Microsoft\\Windows'
                 '\\Start Menu\\Programs\\Accessories\\Notepad.exe'],
                 'C:\\Users\\Edvin\\Desktop\\Example.txt')
</code></pre>

<p>but this comes up with <code>TypeError: bufsize must be an integer</code> error.</p>

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

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

<pre><code>subprocess.call(["command here", "arguments here"])
</code></pre>

<p>if it's an <code>exe</code> use</p>

<pre><code>subprocess.call(['C:\\...\\program.exe', 'argument'])
</code></pre>

<p>if it's a python script use</p>

<pre><code>execfile('file.py')
</code></pre>

python windows permissions subprocess python-3.5