Answers.Body: <p>Seems to be working just fine:</p>
  
  <pre><code>&gt;&gt;&gt; from subprocess import Popen, PIPE
  &gt;&gt;&gt; p = Popen( 'stockfish', stdout=PIPE, stdin=PIPE)
  &gt;&gt;&gt; p.stdin.write('uci\n')
  &gt;&gt;&gt; p.stdin.write('go depth 10\n')
  &gt;&gt;&gt; print p.communicate()[0]
  Stockfish 09-06-13 64bit by Tord Romstad, Marco Costalba and Joona Kiiski
  id name Stockfish 09-06-13 64bit
  id author Tord Romstad, Marco Costalba and Joona Kiiski
  
  option name Use Debug Log type check default false
  option name Use Search Log type check default false
  option name Search Log Filename type string default SearchLog.txt
  option name Book File type string default book.bin
  option name Best Book Move type check default false
  option name Contempt Factor type spin default 0 min -50 max 50
  option name Mobility (Middle Game) type spin default 100 min 0 max 200
  option name Mobility (Endgame) type spin default 100 min 0 max 200
  option name Passed Pawns (Middle Game) type spin default 100 min 0 max 200
  option name Passed Pawns (Endgame) type spin default 100 min 0 max 200
  option name Space type spin default 100 min 0 max 200
  option name Aggressiveness type spin default 100 min 0 max 200
  option name Cowardice type spin default 100 min 0 max 200
  option name Min Split Depth type spin default 7 min 4 max 12
  option name Max Threads per Split Point type spin default 5 min 4 max 8
  option name Threads type spin default 8 min 1 max 64
  option name Use Sleeping Threads type check default true
  option name Hash type spin default 32 min 1 max 8192
  option name Clear Hash type button
  option name Ponder type check default true
  option name OwnBook type check default false
  option name MultiPV type spin default 1 min 1 max 500
  option name Skill Level type spin default 20 min 0 max 20
  option name Emergency Move Horizon type spin default 40 min 0 max 50
  option name Emergency Base Time type spin default 200 min 0 max 30000
  option name Emergency Move Time type spin default 70 min 0 max 5000
  option name Minimum Thinking Time type spin default 20 min 0 max 5000
  option name Slow Mover type spin default 100 min 10 max 1000
  option name UCI_Chess960 type check default false
  option name UCI_AnalyseMode type check default false
  uciok
  info depth 1 seldepth 1 score cp 76 nodes 28 nps 28000 time 1 multipv 1 pv b1c3
  info depth 2 seldepth 2 score cp 12 nodes 166 nps 166000 time 1 multipv 1 pv b1c3 b8c6
  info depth 3 seldepth 3 score cp 72 nodes 300 nps 300000 time 1 multipv 1 pv b1c3 e7e5 g1f3
  info depth 4 seldepth 4 score cp 12 nodes 692 nps 346000 time 2 multipv 1 pv b1c3 g8f6 g1f3 b8c6
  info depth 5 seldepth 5 score cp 64 nodes 1311 nps 655500 time 2 multipv 1 pv b1c3 g8f6 g1f3 b8c6 e2e4
  info depth 6 seldepth 7 score cp 12 nodes 4288 nps 857600 time 5 multipv 1 pv b1c3 g8f6 g1f3 b8c6 e2e4 d7d5
  info depth 7 seldepth 7 score cp 28 nodes 5522 nps 920333 time 6 multipv 1 pv b1c3 g8f6 g1f3 b8c6 d2d4 d7d5 e2e3
  info depth 8 seldepth 8 score cp 12 nodes 9003 nps 1286142 time 7 multipv 1 pv b1c3 g8f6 g1f3 b8c6 d2d4 d7d5 e2e3 e7e6
  info depth 9 seldepth 13 score cp 48 nodes 21652 nps 1273647 time 17 multipv 1 pv b1c3 g8f6 g1f3 b8c6 e2e3 d7d5 f1b5 c8d7 e1g1 a7a6 b5c6 d7c6
  info depth 10 seldepth 16 score cp 52 nodes 34328 nps 1373120 time 25 multipv 1 pv b1c3 g8f6 g1f3 b8c6 e2e4 e7e5 d2d4 e5d4 f3d4 d7d5 e4d5 f6d5 d4c6 b7c6
  info nodes 34328 time 25
  bestmove b1c3 ponder g8f6
  
  &gt;&gt;&gt;
  </code></pre>
  
  <p>Don't forget to send <code>uci</code> command after loading the engine, so it can initialize all internal stuff and get ready. This is required by UCI protocol.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-09-23T11:40:52.433Z
Answers.Text: Thank you so much!) 
  I forgot send "uci"
Answers.UserDisplayName: MrTrushka
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-09-22T10:43:33.293Z
Answers.LastActivityDate: 2018-09-22T10:43:33.293Z
Answers.UserDisplayName: lenik
Answers.Body: <p>To get evaluation score for each legal move, you can do:</p>
  
  <ul>
  <li>Set MultiPV to a high number, like in your answer</li>
  <li>Play the moves, then invoke SF on each of the resulting FEN. For example, in the starting position you could start 20 SF instances, one for each possible move. This is the approach adopted by commercial companies, such as Chessable.</li>
  </ul>
  
  <p>The first approach works but it's slow and not exactly scalable.</p>
  
  <p>PS: Asking for Python code is off-topic here. We can guide you but we won't write code for you.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-09-15T14:59:27.490Z
Answers.Text: What is SF????(
Answers.UserDisplayName: MrTrushka
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-09-15T15:00:23.537Z
Answers.Text: @АртемСкарубо Stockfish
Answers.UserDisplayName: SmallChess
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-09-15T15:00:56.303Z
Answers.Text: @АртемСкарубо Please read the package documentation carefully. It has what you want.
Answers.UserDisplayName: SmallChess
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-09-15T15:01:19.510Z
Answers.Text: @АртемСкарубо https://python-chess.readthedocs.io/en/latest/uci.html
Answers.UserDisplayName: SmallChess
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-09-15T15:23:14.540Z
Answers.Text: @АртемСкарубо chess.uci.Score in the link
Answers.UserDisplayName: SmallChess
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-09-15T14:32:06.333Z
Answers.LastActivityDate: 2018-09-15T14:53:35.820Z
Answers.LastEditDate: 2018-09-15T14:53:35.820Z
Answers.UserDisplayName: SmallChess
Body: <p>I'm working with Stockfish in Python 3.</p>
  
  <p>And when I do something like this:</p>
  
  <p><a href="https://i.sstatic.net/ZK1AS.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/ZK1AS.png" alt="Enter image description here"></a></p>
  
  <p>I get just "bestmove e2e4". How can I retrieve full information?</p>
  
  <p>Like this:</p>
  
  <p><a href="https://i.sstatic.net/F02bG.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/F02bG.png" alt="Enter image description here"></a></p>
  
Tags: <uci><python>
Title: Python and UCI engine
ThreadText: # Python and UCI engine
  
  (Asked by: username_0 on 2018-09-15)
  
  I'm working with Stockfish in Python 3.
  
  And when I do something like this:
  
  [![Enter image description here](https://i.sstatic.net/ZK1AS.png)](https://i.sstatic.net/ZK1AS.png)
  
  I get just "bestmove e2e4". How can I retrieve full information?
  
  Like this:
  
  [![Enter image description here](https://i.sstatic.net/F02bG.png)](https://i.sstatic.net/F02bG.png)
  
  **Tags:** uci, python
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2018-09-22. Score: 1 | Accepted answer
  
  Seems to be working just fine:
  
  ```
  >>> from subprocess import Popen, PIPE
  >>> p = Popen( 'stockfish', stdout=PIPE, stdin=PIPE)
  >>> p.stdin.write('uci\n')
  >>> p.stdin.write('go depth 10\n')
  >>> print p.communicate()[0]
  Stockfish 09-06-13 64bit by Tord Romstad, Marco Costalba and Joona Kiiski
  id name Stockfish 09-06-13 64bit
  id author Tord Romstad, Marco Costalba and Joona Kiiski
  
  option name Use Debug Log type check default false
  option name Use Search Log type check default false
  option name Search Log Filename type string default SearchLog.txt
  option name Book File type string default book.bin
  option name Best Book Move type check default false
  option name Contempt Factor type spin default 0 min -50 max 50
  option name Mobility (Middle Game) type spin default 100 min 0 max 200
  option name Mobility (Endgame) type spin default 100 min 0 max 200
  option name Passed Pawns (Middle Game) type spin default 100 min 0 max 200
  option name Passed Pawns (Endgame) type spin default 100 min 0 max 200
  option name Space type spin default 100 min 0 max 200
  option name Aggressiveness type spin default 100 min 0 max 200
  option name Cowardice type spin default 100 min 0 max 200
  option name Min Split Depth type spin default 7 min 4 max 12
  option name Max Threads per Split Point type spin default 5 min 4 max 8
  option name Threads type spin default 8 min 1 max 64
  option name Use Sleeping Threads type check default true
  option name Hash type spin default 32 min 1 max 8192
  option name Clear Hash type button
  option name Ponder type check default true
  option name OwnBook type check default false
  option name MultiPV type spin default 1 min 1 max 500
  option name Skill Level type spin default 20 min 0 max 20
  option name Emergency Move Horizon type spin default 40 min 0 max 50
  option name Emergency Base Time type spin default 200 min 0 max 30000
  option name Emergency Move Time type spin default 70 min 0 max 5000
  option name Minimum Thinking Time type spin default 20 min 0 max 5000
  option name Slow Mover type spin default 100 min 10 max 1000
  option name UCI_Chess960 type check default false
  option name UCI_AnalyseMode type check default false
  uciok
  info depth 1 seldepth 1 score cp 76 nodes 28 nps 28000 time 1 multipv 1 pv b1c3
  info depth 2 seldepth 2 score cp 12 nodes 166 nps 166000 time 1 multipv 1 pv b1c3 b8c6
  info depth 3 seldepth 3 score cp 72 nodes 300 nps 300000 time 1 multipv 1 pv b1c3 e7e5 g1f3
  info depth 4 seldepth 4 score cp 12 nodes 692 nps 346000 time 2 multipv 1 pv b1c3 g8f6 g1f3 b8c6
  info depth 5 seldepth 5 score cp 64 nodes 1311 nps 655500 time 2 multipv 1 pv b1c3 g8f6 g1f3 b8c6 e2e4
  info depth 6 seldepth 7 score cp 12 nodes 4288 nps 857600 time 5 multipv 1 pv b1c3 g8f6 g1f3 b8c6 e2e4 d7d5
  info depth 7 seldepth 7 score cp 28 nodes 5522 nps 920333 time 6 multipv 1 pv b1c3 g8f6 g1f3 b8c6 d2d4 d7d5 e2e3
  info depth 8 seldepth 8 score cp 12 nodes 9003 nps 1286142 time 7 multipv 1 pv b1c3 g8f6 g1f3 b8c6 d2d4 d7d5 e2e3 e7e6
  info depth 9 seldepth 13 score cp 48 nodes 21652 nps 1273647 time 17 multipv 1 pv b1c3 g8f6 g1f3 b8c6 e2e3 d7d5 f1b5 c8d7 e1g1 a7a6 b5c6 d7c6
  info depth 10 seldepth 16 score cp 52 nodes 34328 nps 1373120 time 25 multipv 1 pv b1c3 g8f6 g1f3 b8c6 e2e4 e7e5 d2d4 e5d4 f3d4 d7d5 e4d5 f6d5 d4c6 b7c6
  info nodes 34328 time 25
  bestmove b1c3 ponder g8f6
  
  >>>
  
  ```
  
  Don't forget to send `uci` command after loading the engine, so it can initialize all internal stuff and get ready. This is required by UCI protocol.
  
  > **Comments:**
  > **username_0**: Thank you so much!)  I forgot send "uci"  
  
  ---
  
  ### Answer by username_2 on 2018-09-15. Score: 2
  
  To get evaluation score for each legal move, you can do:
  
  * Set MultiPV to a high number, like in your answer
  * Play the moves, then invoke SF on each of the resulting FEN. For example, in the starting position you could start 20 SF instances, one for each possible move. This is the approach adopted by commercial companies, such as Chessable.
  
  The first approach works but it's slow and not exactly scalable.
  
  PS: Asking for Python code is off-topic here. We can guide you but we won't write code for you.
  
  > **Comments:**
  > **username_0**: What is SF????(  
  > **username_2**: @АртемСкарубо Stockfish  
  > **username_2**: @АртемСкарубо Please read the package documentation carefully. It has what you want.  
  > **username_2**: @АртемСкарубо https://python-chess.readthedocs.io/en/latest/uci.html  
  > **username_2**: @АртемСкарубо chess.uci.Score in the link  
  
  ---
  
  