Sublime Forum

Can't Build Python

#1

Hi all, apologies as I am completely new to Python and Sublime Text but as you can see below I am unable to build anything. I imagine it is a path problem. I am able to use Python in terminal (I’m on a Mac and installed Python 3.7 btw) and the build system is set to Python, not automatic. Can anyone help me figure this one out? Thanks!

/usr/local/opt/python/bin/python3.7: can’t find ‘main’ module in ‘’
[Finished in 0.2s with exit code 1]
[shell_cmd: python3 -OO -u “”]
[dir: /Users/XXX/Library/Application Support/Sublime Text 3/Packages]
[path: /Users/XXX/bin:/Users/XXX/bin:/usr/local/opt/python/libexec/bin:/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin]

0 Likes

#2

Based on the error message you’re seeing, it’s running python3 just fine but the problem is that you didn’t save the file before you ran the build. In the message can't find 'main' module in '', the '' is the name of the file that the error happened in, which isn’t anything.

If you save the file first, it should build just fine. You can also make sure that Tools > Save all on build is checked which will make Sublime automatically save files before it runs a build, although you do still need to save a new file once manually.

0 Likes

Sublime Text - Python Run Error
Python3 on Mac (Big Sur)
Can't find main module in error