I can't execute Python code

When I try to execute some python code, I get a magnifying glass at the bottom. See image below:

And I know the code is correct since I successfully ran it in IDLE.

Any solutions to this problem are much appreciated.

  • file untitled
  • file does not have *.py extension (how does Atom know what it is?)
  • file is not saved

I tried that, but it didn’t work.
Interestingly, when I type in print(“Hello World”), it works. If you try to do anything beyond that (such as variables), it doesn’t work.

If you try to do anything beyond that

Anything? Or specifically input?

It seems that only inputs aren’t working - Turtle graphics and looping all work. But of course, inputs are very important in Python and should work.

@d_l The script package does not take input.

So I now read …

The option with the best chance of success is to run the script or program from the terminal that comes with your operating system.

Then (for my Ubuntu case) I would create a script which runs the python script in say gnome-terminal.

So how do I run inputs in Atom? It’s a part of Python, so why doesn’t it work?

I did not write the script package, so I wouldn’t know. I can recommend using a terminal emulator such as termination if input is important to you. Personally, I only used input when learning Python anyway. So I would disagree with your “inputs are very important in Python” claim.

You aren’t the only one that has discovered this: https://github.com/rgbkrk/atom-script/issues/1738

and https://github.com/rgbkrk/atom-script/issues/1630

OP might try python tkinter which does launch window as GUI.
Data entry fields can be added.

This is an example “hello world” (look for a tiny window created top left of screen).

import tkinter

window = tkinter.Tk()
# to rename the title of the window
# pack is used to show the object in the window
label = tkinter.Label(window, text = "Hello World!").pack()