Sublime Forum

Getting this error: Can't find '__main__' module in ''

#1

Hi there, I’m new to programming and I want to try Python 3 with Sublime 3. But I can’t get it to work at all. When I try to build it says this:

/usr/local/bin/python3: can’t find ‘main’ module in ‘’
[Finished in 0.4s with exit code 1]
[cmd: [’/usr/local/bin/python3’, ‘-u’, ‘’]]
[dir: /Applications/Sublime Text.app/Contents/MacOS]
[path: /Library/Frameworks/Python.framework/Versions/3.7/bin:/Users/blackbox/anaconda3/bin:/Library/Frameworks/Python.framework/Versions/3.7/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin]

I am using Mac OS Mojave
how to fix this issue?

0 Likes

#2
0 Likes

#3

I figured it out, looks like I did not save the file.:face_with_monocle:

0 Likes

#4

So this is essentially a file creation/locking issue. The Python3 libraries can’t execute the script because it doesn’t exist. Is there a way to instruct Sublime to auto-save in a location when I open a new file?

0 Likes

#5

There is no such direct action; creating a new tab always gives you a new area with no name associated with it, and only saving a file to disk persists it there.

Note that Tools > Save all on build will automatically save changes to open files that already have a name on disk so you only need to save a brand new file manually when you first create it.

Packages likes AdvancedNewFile and FileManager (and possibly others as well) provide functionality whereby you need to type the name and location of the file at the point where you create it so that it has a name on disk right away, if that makes your workflow easier.

0 Likes