Sublime Forum

Build System Python Help

#1

Hello everyone,

I have Sublime Text 3, Windows 10, 64-bit, I’m writing on Python3.4. What should my Build code look like?
Currently it looks like this:

{ "cmd": ["d:/Program Files/Python/python.exe", "-u", "$file"], "file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)", "selector": "source.python" }

where "d:/Program Files/Python/python.exe" is the directory to the python itself.

I am new to the world of programming and I have no idea about JSON, so if you can just give me the code i should plug in it would be very helpful.

Cheers

0 Likes

#2

What’s the problem with your settings?
Maybe change the directory separator from / to \\.

0 Likes

#3

I have changed those, however nothing really changed. When I try to build the program it opens the writing space in the bottom of the Sublime Text window. But when I type in the input values and hit Enter nothing happens. When I click “Show Build Results” nothing happens.

0 Likes

#4

The “build result panel” is just a capture of the output result.

This is probably the most frequently asked question for ST users.

2 Likes

#5

Thanks a lot!!!

0 Likes

#6

Also, since you are using Python 3 (or at least have it installed), I strongly suggest using a build system as follows:

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

This will run Python with the awesome Windows Python Launcher that can do a couple things like detecting and running the correct Python version if there is a shebang line in the source file or detects active virtualenvs. If you don’t know what that is, use this anyway. (And if for some reason that does not work, change it back to what worked.)

1 Like