Sublime Forum

Py2to3 - translate python 2 to 3 and assist ST2->ST3

#1

Hi,

here is a very simply plugin that runs 2to3 on the currently open python file and opens a new diff file to show the changes. The original python file is overwritten and a backup is saved as file.py.bak. Errors from 2to3 are printed to the console. The idea is to make it easier to run 2to3 when adapting ST2 plugins to ST3. Feel free to send pull request for other changes that make the ST2 to ST3 conversion easier.

github.com/jlegewie/Py2to3

0 Likes

#2

Here is one problem I encountered that are not fixed with 2to3:
subprocess functions return b"…", which have to be converted using b"…".decode(“utf-8”) to print etc.

0 Likes