Sublime Forum

[WinError 2] The system cannot find the file specified version999

#1

Hi, you must be tired of sorting these errors! Please advise where I’m going wrong with Sublimetext with python. I have looked at similar posts but none seem to match.
My error message is below. My path environment variables point to python, my working folder and the launcher.
I have been plugging away at this for ages - just want to get coding!
Thanks
I can access python 3.9.5 from the command line.

[WinError 2] The system cannot find the file specified
[cmd: [‘python3’, ‘-u’, ‘C:\Users\Sime\Documents\python_work\hello_world2.py’]]
[dir: C:\Users\Sime\Documents\python_work]
[path: C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0;C:\WINDOWS\System32\OpenSSH;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\170\Tools\Binn;C:\Program Files (x86)\Microsoft SQL Server\150\Tools\Binn;C:\Program Files\Microsoft SQL Server\150\Tools\Binn;C:\Program Files\Microsoft SQL Server\150\DTS\Binn;C:\Program Files (x86)\Microsoft SQL Server\150\DTS\Binn;C:\Program Files\Azure Data Studio\bin;C:\Python39\Scripts;C:\Python39;C:\Users\Sime\AppData\Local\Programs\Python\Launcher;C:\Users\Sime\Documents\python_work;]
[Finished]

0 Likes

#2

Windows doesn’t know about python3.exe. You’d need to change your build system to make it call py (the launcher app used on Windows) or python which is the default executable name.

Sublime Text 4 now shipps with a python build system using the py launcher on Windows OS, while maintaining python3 on Linux/Mac.

If you are still on ST3 you can create a Python.sublime-build in your User package (or in Packages/Python) to override the default.

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

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

	"windows": {
		"cmd": ["py", "-u", "$file"],
	},

	"variants":
	[
		{
			"name": "Syntax Check",
			"cmd": ["python3", "-m", "py_compile", "$file"],

			"windows": {
				"cmd": ["py", "-m", "py_compile", "$file"],
			}
		}
	]
}
0 Likes

#3

Hi deathaxe. thanks for replying.

  1. “change your build system” - is this via the Tools > Build System ? I had chosen Python3 here.

  2. I am on ST build 4017. I assume this is ST4. What exactly do I do now please? Do I run your script?

Thanks

0 Likes

#4

You can read up on build system here: https://www.sublimetext.com/docs/build_systems.html. In essence you want to first get it working on the command line for an easy transition to a build system.

0 Likes

#5

Thanks bschaaf. I changed the Tools > Build System option to Automatic and it is working OK. Obviously doesn’t address the problem but I am able to get on.
For some reason my account has been suspended - no idea why.
SimeB

0 Likes