user18019: Background:  I wrote and use a custom macro in the NoteTab Pro text editor to convert PGN position analysis to XML.  The resulting XML is used on my website to display chess puzzles.  I need to check for legal moves in some cases.  For example, a PGN move might say Rd6 in a position where two rooks can move to d6, but only one of them can legally move to d6 because the other is pinned to its King.  I am disinclined to write a macro legal move checker due to the apparent complexity of the task.  I do not want to reinvent the wheel.
Ideally, I am looking for an executable that can be called with FEN and next-move parameters, and return a positive or negative result based on the move's legality.

user825: Simple problem. python-chess is a useful Python package that can do it for you easily. You will need to get a FEN, check if your move is a legal move.

https://pypi.org/project/python-chess/

has everything you want.

18019: <p><strong>Background:</strong>  I wrote and use a custom macro in the NoteTab Pro text editor to convert PGN position analysis to XML.  The resulting XML is used on my website to display chess puzzles.  I need to check for legal moves in some cases.  For example, a PGN move might say Rd6 in a position where two rooks can move to d6, but only one of them can legally move to d6 because the other is pinned to its King.  I am disinclined to write a macro legal move checker due to the apparent complexity of the task.  I do not want to reinvent the wheel.</p>

<p>Ideally, I am looking for an executable that can be called with FEN and next-move parameters, and return a positive or negative result based on the move's legality.</p>
 825: <p>Simple problem. <code>python-chess</code> is a useful Python package that can do it for you easily. You will need to get a FEN, check if your move is a legal move.</p>

<blockquote>
  <p><a href="https://pypi.org/project/python-chess/" rel="nofollow noreferrer">https://pypi.org/project/python-chess/</a></p>
</blockquote>

<p>has everything you want.</p>
