Sublime Forum

Help please installing for Python on Ubuntu desktop

#1

I’ve successfully installed Sublime Text with Python on two Windows 10 machines. I already have Python 3 installed on the Ubuntu computer and installed Sublime Text from the graphical interface and later, after removing it, via the command line. It appears to install ok but doesn’t seem to link to Python. Running a hello world one liner doesn’t show in the Sublime Text console.

Is there a good tutorial on how to correctly install and configure please or can anyone advise me of the necessary steps?

Many thanks in advance,

Kind regards,

Mark.

0 Likes

#2

What error does it show when you try to run your python script?

0 Likes

#3

Initially, there was no error. There just no output in the console window as opposed to the expected output that I get on the Windows implementation. Then, I tried following some advice I found in Google:running ‘build new’, editing the file that popped up, saving it and then selecting the new, resulting option in the build menu. This resulted in a longish message that started with something about not finding ‘main’ but I didn’t note it down and have uninstalled Sublime text on my Ubuntu laptop in anticipation of a fresh attempt.

0 Likes

#4

Have you saved your file as a python script, with a .py extension?

0 Likes

#5

Yes, indeed.

0 Likes

#6

Can you provide a screenshot of the error?

0 Likes

#7

Just to make it interesting, I’ve installed fedora 37 on the computer, completely replacing Ubuntu.

Python is already installed and runs in a terminal window with either python or python3. It seems to be behaving in exactly the same way as with Ubuntu. I opened a small Python file hello.py, ran build system with Python selected followed by build. The console window opens but with no output.

0 Likes

#8

Dear bschaaf,

I’ve just discovered my error. Sorry for wasting your time and thanks for your patience. When I clicked build, a small window popped up , not aligned with anything in particular, with two rows, the upper with the word Python and the lower with something like syntax check. After clicking the upper row (Python) the window quickly aligned itself with the lower part of the text editor window and delivered the expected output…

0 Likes

#9

Indeed, for future reference the Syntax Check variant does exactly that; it only compiles the code to see if it is correct. You will end up with a pyc file in the folder with it, and it generates no output unless your code is broken.

This particular error is about it not being able to find __main__, which you will most frequently see when you forget to save a new file; it will tell you that the filename it looked in is '', which is an indication that the file doesn’t have a name on disk and thus can’t be seen by the interpreter.

0 Likes