Sublime Forum

Built-in interpreter for python 3?


As I understand, latest subliem version 3.2 does not support python 3 yet (how come?), so I found many tutorials showing how to make a cutom build for python 3, something like this:

“cmd”: [“python3”, “$file”],
“file_regex”: “^[ ]File “(…?)”, line ([0-9]*)”,
“selector”: “source.python”

It can run and show output perfectly, but there’s a very important issue, is that it when I click on the traceback, it sublime doesn’t bring me to the location.

Does anyone know a work around for this? I think this feature is really helpful.

Thank you!



Sublime supports running any external tool you want, and it’s syntax highlighting covers both Python 2 and Python 3. There may be some confusion regarding support here because the built in Python.sublime-build executes python. Depending on the operating system you’re using, that might be Python 2, it might be Python 3, or it might not work at all (for example if you’re on WIndows, which doesn’t have Python by default).

Possibly the reason it’s not working is that the file_regex you’re using is not correct. As portrayed in your post above it’s wrong, but that could be because you didn’t tell the forum that it’s preformatted text, so it may be displaying incorrectly.

This works for me; it’s a version of the Python.sublime-build that ships with Sublime with python replaced with python3:

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

	"env": {"PYTHONIOENCODING": "utf-8"},

			"name": "Syntax Check",
			"shell_cmd": "python3 -m py_compile \"${file}\"",
1 Like


It works like a champ. Thank you!