user24582: I know this isn't a programming forum, though it's chess-related, hence the placement on here. Basically, I'm trying to setup stockfish with Python on my PC. I installed it via pip install stockfish.
So I went on and tried to setup the Stockfish via:
from stockfish import Stockfish

stockfish = Stockfish(r'C:\Users\Acer\Desktop\chess\stockfish-11-win')

That throws a WinError 5, access denied:
Exception ignored in: <function Stockfish.__del__ at 0x0429AA48>
Traceback (most recent call last):
  File "C:\Users\Acer\AppData\Local\Programs\Python\Python38-32\lib\site-packages\stockfish\models.py", line 270, in __del__
    self.stockfish.kill()
AttributeError: 'Stockfish' object has no attribute 'stockfish'
Traceback (most recent call last):
  File "<pyshell#4>", line 1, in <module>
    emily = Stockfish(r'C:\Users\Acer\Desktop\chess\stockfish-11-win\src')
  File "C:\Users\Acer\AppData\Local\Programs\Python\Python38-32\lib\site-packages\stockfish\models.py", line 33, in __init__
    self.stockfish = subprocess.Popen(
  File "C:\Users\Acer\AppData\Local\Programs\Python\Python38-32\lib\subprocess.py", line 854, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "C:\Users\Acer\AppData\Local\Programs\Python\Python38-32\lib\subprocess.py", line 1307, in _execute_child
    hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
PermissionError: [WinError 5] Zugriff verweigert

I tried different Stockfish Downloads, running the Idle or CMD as admin, re-installed and used different PCs, but I somehow don't get to work with Stockfish - anyone able to help me out bypassing the access denied? What do I miss when initializing?

user24053: The argument needs to point to the Stockfish executable. If you download the v11 zip from the Stockfish website, extract it and find the directories with the executables.
I extracted it to C:\Users\<username>\Downloads\stockfish-11-win
The executables are in C:\Users\<username>\Downloads\stockfish-11-win\Windows

To use the executable, give the path to the executable like so:
from stockfish import Stockfish

stockfish = Stockfish(r'C:\Users\<username>\Downloads\stockfish-11-win\Windows\stockfish_20011801_x64.exe')

The default value for the path you give is "stockfish", so if you add your directory with the executables to the path, and rename the exe you want to stockfish, you should be able to do:
from stockfish import Stockfish

stockfish = Stockfish()

Re. your comment:

no other stockfish related "commands" will work: OSError: [Errno 22] Invalid argument  ... so it seemingly fixed a problem but the next instantly occured.

The ArgumentError is presumably because you're passing a wrong argument. For example, I ran the commands in the readme in the github repository and it works perfectly fine.


24582: <p>I know this isn't a programming forum, though it's chess-related, hence the placement on here. Basically, I'm trying to setup stockfish with Python on my PC. I installed it via <code>pip install stockfish</code>.</p>
<p>So I went on and tried to setup the Stockfish via:</p>
<pre><code>from stockfish import Stockfish

stockfish = Stockfish(r'C:\Users\Acer\Desktop\chess\stockfish-11-win')
</code></pre>
<p>That throws a WinError 5, access denied:</p>
<pre><code>Exception ignored in: &lt;function Stockfish.__del__ at 0x0429AA48&gt;
Traceback (most recent call last):
  File &quot;C:\Users\Acer\AppData\Local\Programs\Python\Python38-32\lib\site-packages\stockfish\models.py&quot;, line 270, in __del__
    self.stockfish.kill()
AttributeError: 'Stockfish' object has no attribute 'stockfish'
Traceback (most recent call last):
  File &quot;&lt;pyshell#4&gt;&quot;, line 1, in &lt;module&gt;
    emily = Stockfish(r'C:\Users\Acer\Desktop\chess\stockfish-11-win\src')
  File &quot;C:\Users\Acer\AppData\Local\Programs\Python\Python38-32\lib\site-packages\stockfish\models.py&quot;, line 33, in __init__
    self.stockfish = subprocess.Popen(
  File &quot;C:\Users\Acer\AppData\Local\Programs\Python\Python38-32\lib\subprocess.py&quot;, line 854, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File &quot;C:\Users\Acer\AppData\Local\Programs\Python\Python38-32\lib\subprocess.py&quot;, line 1307, in _execute_child
    hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
PermissionError: [WinError 5] Zugriff verweigert
</code></pre>
<p>I tried different Stockfish Downloads, running the Idle or CMD as admin, re-installed and used different PCs, but I somehow don't get to work with Stockfish - anyone able to help me out bypassing the access denied? What do I miss when initializing?</p>
 24053: <p>The argument needs to point to the Stockfish executable. If you download the <a href="https://stockfishchess.org/files/stockfish-11-win.zip" rel="nofollow noreferrer">v11 zip from the Stockfish website</a>, extract it and find the directories with the executables.</p>
<p>I extracted it to <code>C:\Users\&lt;username&gt;\Downloads\stockfish-11-win</code></p>
<p>The executables are in <code>C:\Users\&lt;username&gt;\Downloads\stockfish-11-win\Windows</code></p>
<p><a href="https://i.stack.imgur.com/2zBY5.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/2zBY5.png" alt="Stockfish executables" /></a></p>
<p>To use the executable, give the path <em>to the executable</em> like so:</p>
<pre><code>from stockfish import Stockfish

stockfish = Stockfish(r'C:\Users\&lt;username&gt;\Downloads\stockfish-11-win\Windows\stockfish_20011801_x64.exe')
</code></pre>
<p>The default value for the path you give is <code>&quot;stockfish&quot;</code>, so if you add your directory with the executables to the path, and rename the exe you want to <code>stockfish</code>, you should be able to do:</p>
<pre><code>from stockfish import Stockfish

stockfish = Stockfish()
</code></pre>
<p>Re. your comment:</p>
<blockquote>
<p>no other stockfish related &quot;commands&quot; will work: <code>OSError: [Errno 22] Invalid argument</code>  ... so it seemingly fixed a problem but the next instantly occured.</p>
</blockquote>
<p>The ArgumentError is presumably because you're passing a wrong argument. For example, I ran the commands in the <a href="https://github.com/zhelyabuzhsky/stockfish/blob/master/README.md" rel="nofollow noreferrer">readme in the github repository</a> and it works perfectly fine.</p>
<p><a href="https://i.stack.imgur.com/BtIJr.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/BtIJr.png" alt="Demo" /></a></p>
