Home Download Buy Blog Forum Support

Using py instead of python for build

Using py instead of python for build

Postby AndyPhilpotts on Sun Apr 13, 2014 5:37 pm

I prefer to use py, (the python launcher) rather than python as it makes it easy to select the appropriate version of python, I struggled a little bit but here is what worked for me (Sublime 3 on Windows only)

First I wanted to see what the built in Python.sublime-build settings looked like, to do this I unzipped the existing package file from the Sublime packages folder, somewhere like C:\Program Files\Sublime Text 3\Packages, this step is tricky as it is not obvious the package files are in fact zip files.

In the zip file look for Python.sublime-build, to save you some time it looks like:

Code: Select all
{
   "shell_cmd": "python -u \"$file\"",
   "file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
   "selector": "source.python"
}


To tweak this, change the shell_cmd value to replace "python" with "py" then save the result in

Code: Select all
%APPDATA%\Sublime Text 3\Packages\Python\Python.sublime-build


(note, %APPDATA% is an environment variable, and will be something like C:\Users\USERNAME\AppData\Roaming)
AndyPhilpotts
 
Posts: 2
Joined: Mon Aug 20, 2012 3:33 pm

Return to General Discussion

Who is online

Users browsing this forum: Exabot [Bot], Google [Bot] and 8 guests