Sublime Forum

Unable to Run a program on sublime text on MBP

#1

I went to tools>Build System>New Build System from subime text on MacBook pro deleted the old text in editor and entered {
“cmd”: [“python3”, “-u”, “%file”],
}

then saved that as python3.sublime-build in the default directory user

however while clicking on enter after saving the file in sublime text it’s giving the below error:

/Library/Frameworks/Python.framework/Versions/3.10/bin/python3: can’t open file ‘/Users/myname/DATA/python_work/%file’: [Errno 2] No such file or directory
[Finished in 54ms with exit code 2]
[cmd: [‘python3’, ‘-u’, ‘%file’]]
[dir: /Users/ajeetkumarmishra/DATA/python_work]
[path: /Library/Frameworks/Python.framework/Versions/3.10/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin]

Kindly assist on this.

0 Likes

#2

Reading the error message carefully …

… can’t open file ‘/Users/myname/DATA/python_work/%file’

… quickly reveals %file not being expanded as it is not a supported variable in build systems.


That said, default python build script is already doing exactly what you seem to want.

Just to avoid future questions: ST’s build system is no interactive shell. Hence you won’t be able to run scripts which require interactive inputs (aka calling input() or something related).

0 Likes