Florian's rambling place

Multiple Python versions with SublimeText-flake8

published 2017-03-17 10:50:00

I couldn't get linting for different Python versions working with SublimeLinter-flake8. It only ever worked with either Python 2.x or Python 3.x.

The following is the way I got it working. If anyone knows a better way, please let me know.

Thanks to the changes in PR #47 and the following script, I was able to get it to work.

#!/Users/fschulze/Zope/python/python-2.7/bin/python2.7
import os
import sys

python = "python%s.%s" % sys.version_info[:2]
os.execvp(python, [python, '-m', 'flake8'] + sys.argv[1:])

The flake8 package needs to be installed in the relevant Python versions.

To debug, follow the troubleshooting guide of SublimeLinter3.