Sublime Forum

My program will not run

#1

I am a complete beginner at using python and sublime.


What could this error message mean? I believe I have python3 installed already.

0 Likes

#2

The diagnostic output shows you the command that was executed:

[cmd: ['/usr/local/bin/python3', '-u', '%file']]

When you created your custom build system, you use %file instead of $file as the variable that expands out to the name of the current file. As a result it’s not a build variable and doesn’t expand, so Python always thinks that you’re trying to execute the same file (%file).

Editing the build to fix that should resolve the problem.

Alternatively, depending on where you got the information for how to create your own build, for the best out of box experience you might want to instead:

  1. Use View Package File from the command palette to open Python/Python.sublime-build
  2. Copy the text of that build system to the clipboard
  3. Open your custom build and paste the result in, then modify it to use python3 instead of Python (you don’t need to specify the /usr/local/bin because that’s already in your PATH, as seen in the diagnostic output)
  4. Save your build

That will make sure that your custom build does what the internal build would do but using the other Python version. Among other things that also ensures that errors in your code are detected properly so that you can navigate to them and see them inline, which is something that not all instructions for how to do something like this cover.

1 Like