Sublime Forum

How to use built-in python command from ST2

#1

Hi there,

I have a test.py in Sublime Text 2 and I got “CTRL+B” to work with an external Python installed (eg: in “C:\Python26”) that’s in PATH. It’s awesome!

However, I can see Python26 is already came with Subline Text 2 as embeed, however I only see .DLL, and not executable. I am curious if there is a way we can reuse this embeded python so user doens’t have to install external Python?

Thanks,
Zemian

0 Likes

#2

You could make an ST2 command that you use as your build system.
This command could then load your file “test.py” into the editor and execute it.

You can set the command of a build system with the “target” option:

// in "your-command.sublime-build"
{
    "target": "your_command",
    ...
}
0 Likes

#3

Hi

I am not sure I understand your answer.

How do I make a command in ST2? Assuming a json file of your sample is all I need to create a command, then where do I store it, and how do I execute it?

Also, I don’t see how that translate to question I asked: if I have a test.py, how do I execute it with the built-in Python that comes with ST2? Do I replace “your_command” in your sample with “test.py”? Do I create new command for each new files? Doesn’t sound very productive.

Sorry for bringing up noob question, but I like to learn more ST2. Be patient with me.

0 Likes