Skip to content

Update tmx_converter.py to Python 3

Thorbjørn Lindeijer requested to merge python3-tmx-converter into master

Since I'm not too familiar with Python and especially not with updating scripts from Python 2 and 3, I did an excersize with AI, trying to get Claude 3.5 Sonnet to dream up the solution, using aider.

After a little back and forth, resulting in the following 5 commits (squashed), I think the update looks quite alright and passed the test (no changes happening in the existing .wlk files).

  • fix: Update script to handle Python 3 string and bytes encoding
  • fix: Handle bytes-to-string conversion in TMX CSV parsing
  • fix: Preserve binary data writing by using direct bytes conversion
  • refactor: Remove unnecessary decode() call when splitting CSV buffer
  • refactor: Simplify tile conversion by removing unnecessary int() cast

Cost about $0.05 per commit, for a total of $0.22 (and over 100x this in terms of my own time - it would likely have been quicker and more educational to not use AI).

Merge request reports

Loading