Execute Python scripts with input()

Could you please explain step-by-step (or share a link) how to change python2 to python3?
I’ve read half of internet but found no solution that would work for me with script-runner.
I’d really appreciate. Thanks in advance.

1 Like

script-runner doesn’t have a config setting to change the command, but you can change which version of Python responds to the python command by changing the order of the folders in your PATH. What operating system are you on?

Mac OS, El Capitan

What do you see when you type python --version into the Terminal?

I see: Python 2.7.10
And, of course, I have python3 installed plus homebrew.
Sublime Text now runs Python 3 scripts but Atom still resists.

Your attribution is wrong. Atom isn’t resisting anything. script-runner is using the command python, and your computer is set up so that Python 2 is the default. If you want to continue using script-runner, you have to solve the issue outside of Atom, such as by using pyenv.

I know it’s not resisting. Just joking. :wink:
Anyway, I’ll give pyenv a try. Thanks.

DamnedScholar - thanks for help.
Tried pyenv but no success.
I decided to give up and stick with Sublime Text, but I really appreciate your help.


Honestly, how can you guys miss this package? It is featured in atom and on the atom packages site.

The command CTRL-X doesn’t work for me on Mac when I install that plugin. What’s up with that?

I have same problem
Hi
I am using Atom to learn Python
the input is not working as the example below,
name = input (“Enter name:”)
print ("Hello " + name)

Any suggestions how to make work, please?
Did you get any solution?

Like has been previously mentioned in the thread, you can use a terminal package, script-runner, or hydrogen. Some of the other packages (you don’t specify which one you’re using) haven’t been constructed to receive input.

3 Likes

I used script, and both you mentioned are not working too

script is unable to receive input because the author of the package didn’t write it so that it could. If you are having trouble installing or using a package, you need to provide exactly what steps you have taken and what results you are seeing. Have you tried the package termination? It creates a terminal inside Atom (the first thing I mentioned), has no special setup requirements, and gives you easy access to the Python CLI inside Atom.

I will go to visual studio, its much better

1 Like

If you request help from that community, they will thank you if you keep in mind what I’ve told you about specifying what you are trying to do and avoiding creating excessive duplicate posts. :slight_smile:

Use https://atom.io/packages/atom-python-run
It allows for input, then requires you to press a key to terminate the program so you can see the end result of a print command.

Best way I have found is here:

go to settings and click “Open Config Folder” you instead navigate as follows:
.Atom→ packages→ script→ lib→ grammars–>python.coffee

Then, you edit that file in the “exports.Python =” section by replacing both instances of “python” with “python3”

I’m just a begginer in python (and programming in general) but I think the best package to rosolve the problem is atom-python-run, here I post the video that helped me a lot:

For others still looking for solutions for Script. I wrote a small Gist explaining how to link Script and Terminus, so that script can accept input.