A simple python script to convert PGN formats between LiChess and ChessBase.
Clone down the repository:
git clone git@github.com:nas5w/pgn-converter.gitcd into the directory and run the converter
cd pgn-converter
python convert.pyYou should see an output explaining that there are no files to be converted:
-----
No new lichess to chessbase files.
-----
No new chessbase to lichess files.
If you have a pgn file from LiChess that needs to be converted to ChessBase, put the pgn file in the following directory:
lichess-to-chessbase/input
Then, re-run the converter script:
python convert.pyIf the conversion has been successful, you should see the following output:
-----
Converting 1 lichess to chessbase file(s):
my-game-file.pgn...DONE
-----
No new chessbase to lichess files.
If you have a pgn file from ChessBase that needs to be converted to LiChess, put the pgn file in the following directory:
chessbase-to-lichess/input
Then, re-run the converter script:
python convert.pyIf the conversion has been successful, you should see the following output:
-----
No new lichess to chessbase files.
-----
Converting 1 chessbase to lichess file(s):
my-game-file.pgn...DONE
The project has a suite of unit tests covering the conversion logic in utils.py. Tests use the Python standard library unittest and have no external dependencies, so no installation is required.
Run the tests from the project root:
python -m unittest test_utilsFor verbose output showing each individual test:
python -m unittest test_utils -vAll tests should pass:
----------------------------------------------------------------------
Ran 18 tests in 0.004s
OK
If you see any issues or want to make and contributions, please open a GitHub issue and we can discuss!