Not really sure whether I'm just not looking in the right place or whether this feature is yet to be implemented, but after installing the atom script package and testing it out on a program that requires user input, I realize that I can't type in anything for input()
the way I can when running the program from the shell. I stumbled upon this thread which makes me suspect that the feature hasn't been added, but I just wanted to be sure. Isn't this a pretty basic thing to be able to do? Or do I have to stick to using atom purely as a text editor and running the file from the CLI?
相关问题
- how to define constructor for Python's new Nam
- streaming md5sum of contents of a large remote tar
- How to get the background from multiple images by
- Evil ctypes hack in python
- Correctly parse PDF paragraphs with Python
Some text-editors (including Atom and Sublime) don't like user input (
raw_input()
). Yes, you'd have to run the file from CLI.You could, however, get around this problem by using other text editors like Notepad++ (see this answer to run Python in notepad++ - How to Execute a Python File in Notepad ++?), where user input works fine.
If you prefer to switch to Sublime (which also has a problem with user inputs), see this answer - Sublime Text 2 console input.
If you'd want to stick with Atom, an alternative, of course, would be to hard-code the variables you are looking for in raw_input while debugging/developing (but don't forget to switch back to raw_input after debugging).
Install atom-shell-commands .
Look up at the Running in a new window sample in the linked page.
Edit the config file like this :
Note : I saved the launch_python3.cmd in my user folder /.atom, but you can save it elsewhere, it should not be an issue.
The cmd file contents :
Now, you'll find a 'run with python 3' under Packages > Atom Shell Commands.
Edit the name and the keyboard shortcut as you see fit.
Clicking on the menu, a new command prompt window is displayed : it supports also user input.
Worked for me.