Home Download Buy Blog Forum Support

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

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

Postby jlegewie on Mon Feb 04, 2013 1:32 am

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.


https://github.com/jlegewie/Py2to3
jlegewie
 
Posts: 16
Joined: Fri Apr 13, 2012 11:35 am

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

Postby gregor.hoch on Mon Feb 04, 2013 1:46 am

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.
gregor.hoch
 
Posts: 128
Joined: Sat Oct 01, 2011 7:54 pm


Return to Plugin Announcements

Who is online

Users browsing this forum: No registered users and 3 guests