Sublime Forum

WinError2 after update

#1

Today I update ST3, and then it cannot build python files.
Before the update, there was no problem.
The build results are as follows:

[WinError 2] The system cannot find the file specified
[cmd: [‘py’, ‘-m’, ‘py_compile’, ‘C:\Program Files\Sublime Text 3\Lib\python38\sublime.py’]]
[dir: C:\Program Files\Sublime Text 3\Lib\python38]
[path: C:\ProgramData\Anaconda3;C:\ProgramData\Anaconda3\Library\mingw-w64\bin;C:\ProgramData\Anaconda3\Library\usr\bin;C:\ProgramData\Anaconda3\Library\bin;C:\ProgramData\Anaconda3\Scripts;C:\Program Files\IBM\ILOG\CPLEX_Studio201\opl\bin\x64_win64;C:\Program Files\IBM\ILOG\CPLEX_Studio201\opl\oplide;C:\Program Files\IBM\ILOG\CPLEX_Studio201\cplex\bin\x64_win64;C:\Program Files\IBM\ILOG\CPLEX_Studio201\cpoptimizer\bin\x64_win64;C:\Program Files\IBM\ILOG\CPLEX_Studio128\opl\bin\x64_win64;C:\Program Files\IBM\ILOG\CPLEX_Studio128\opl\oplide;C:\Program Files\IBM\ILOG\CPLEX_Studio128\cplex\bin\x64_win64;C:\Program Files\IBM\ILOG\CPLEX_Studio128\cpoptimizer\bin\x64_win64;C:\Program Files\Java\jdk1.8.0_171\bin;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0;C:\WINDOWS\System32\OpenSSH;C:\Program Files (x86)\Pulse Secure\VC142.CRT\X64;C:\Program Files (x86)\Pulse Secure\VC142.CRT\X86;C:\Users\Jaehee\anaconda3;C:\Program Files\Git\cmd;C:\Users\Jaehee\AppData\Local\Microsoft\WindowsApps;C:\usr\texlive\2017\bin\win32;C:\Users\Jaehee\AppData\Local\GitHubDesktop\bin]
[Finished]

I already saw the other questions and answers, but I cannot understand.
Please help me…

0 Likes

#2

Many complaints like that have been reported due to python.exe not being found on Windows in past. That’s why Python.sublime-build was modified to use py.exe which is a launcher installed into C:\Windows directory by “Python for Windows”.

Now that this change was made, it appears all people using Python for Windows are happy, while those using Anaconda or Miniconda fail to run python builds using default build script, because those packages don’t provide a py.exe.

So the question is, who to satisfy: 50% of users using Anaconda or those 50% using Python for Windows?

The only solution is to create your own Python.sublime-build file.

  1. Open Menu > Preferences > Browse Packages...
  2. Create Python folder
  3. Navigate into Python folder
  4. Create Python.sublime-build with following content
{
	"shell_cmd": "python3 -u \"${file}\"",
	"file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
	"selector": "source.python",

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

	"windows": {
		"shell_cmd": "python -u \"${file}\"",
	},

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

			"windows": {
				"shell_cmd": "python -m py_compile \"${file}\"",
			}
		}
	]
}
1 Like

#3

Thank you so much. It works finally.
To make it work, I have to ‘Build With’ first…

0 Likes