Python console windows?


Can I have a console window to see the results of python code ? Sorry if this is straightforward I’m beginning to get into Atom over sublime after a long break.

Python scripts with input()

Yes it is possible.
Look at these:

Be warned - you may need to invoke the same commands as if running from you OS native terminal / shell.


Are you looking for a REPL environment?


More then one line of code atleast four to six lines at minimum that I can say off hand.


I want a terminal window to which using a keyboard short-cut execute the lines of code from the list can you suggest any; and javascript would be nice as well :slight_smile:


See if the following package works for you -

I am no expert,
this one is the closest to what I think script running should be like.
In other words: run script and also have a terminal.
The package does not function on my computer, for some reason.

I am yet to see something that compares with the built-in terminal available in Visual Studio Code.

More ideas look at (✓&q=script-runner&commit=Search)… note the number of installations. Do know that some of those do not have a terminal in the traditional sense. The following code line will not be possible for most on the linked list (excluding script-runner).

_name = input('What is your name? ')


Is it possible to programmatically generate syntax highliting, without using a grammar?

I couldn’t get script-runner to install either ? Any or all script runners / test runners, specifically in the link you posted will run code regardless of language ?


What error do you see?

None of the packages have the innate ability to run code (except JavaScript), because they work by sending commands to external interpreters and compilers. This means that, for generalist packages, supporting additional languages just means having an extra few lines to match for a new language and send out the right command. The packages will tell you what they support, like for script-runner: “It currently supports JavaScript, CoffeeScript, Ruby, Python, Bash, Go and anything with a shebang line.” The advantage of script-runner is that it opens into a terminal window like you said, whereas script, atom-runner, and hydrogen do not.


It’s a long error; want me to post it ? I’ve attempted installing though Atom, this being the forth time; same error more or less.


Absolutely. Make sure to wrap it in code tags (highlight it and press the </> button above the editor) for readability.

![image|677x500](upload://fA9qL8FPAnHNUgJCnC3dNudIyzV.png)> node-pty@0.7.0 install C:\Users\CHRIST~1\AppData\Local\Temp\apm-install-dir-11788-138560-1jczk95.jy94ahh0k9\node_modules\script-runner\node_modules\node-pty
> node scripts/install.js
C:\Users\CHRIST~1\AppData\Local\Temp\apm-install-dir-11788-138560-1jczk95.jy94ahh0k9\node_modules\script-runner\node_modules\node-pty>if not defined npm_config_node_gyp (node "C:\Users\Christopher\AppData\Local\atom\app-1.19.7\resources\app\apm\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node "C:\Users\Christopher\AppData\Local\atom\app-1.19.7\resources\app\apm\bin\\..\node_modules\node-gyp\bin\node-gyp.js" rebuild ) 
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
MSBUILD : warning MSB4010: The "*.tasks" files could not be successfully loaded from their expected location "C:\Windows\Microsoft.NET\Framework\v2.0.50727". Default tasks will not be available.  [C:\Users\CHRIST~1\AppData\Local\Temp\apm-install-dir-11788-138560-1jczk95.jy94ahh0k9\node_modules\script-runner\node_modules\node-pty\build\binding.sln]
MSBUILD : error MSB4036: The "Message" task was not found. Check the following: 1.) The name of the task in the project file is the same as the name of the task class. 2.) The task class is "public" and implements the Microsoft.Build.Framework.ITask interface. 3.) The task is correctly declared with <UsingTask> in the project file, or in the *.tasks files located in the "C:\Windows\Microsoft.NET\Framework\v2.0.50727" directory. [C:\Users\CHRIST~1\AppData\Local\Temp\apm-install-dir-11788-138560-1jczk95.jy94ahh0k9\node_modules\script-runner\node_modules\node-pty\build\binding.sln]
`-- (empty)
gyp ERR! build error 
gyp ERR! stack Error: `C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (C:\Users\Christopher\AppData\Local\atom\app-1.19.7\resources\app\apm\node_modules\node-gyp\lib\build.js:276:23)
gyp ERR! stack     at emitTwo (events.js:106:13)
gyp ERR! stack     at ChildProcess.emit (events.js:191:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12)
gyp ERR! System Windows_NT 10.0.15063
gyp ERR! command "C:\\Users\\Christopher\\AppData\\Local\\atom\\app-1.19.7\\resources\\app\\apm\\bin\\node.exe" "C:\\Users\\Christopher\\AppData\\Local\\atom\\app-1.19.7\\resources\\app\\apm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\CHRIST~1\AppData\Local\Temp\apm-install-dir-11788-138560-1jczk95.jy94ahh0k9\node_modules\script-runner\node_modules\node-pty
gyp ERR! node -v v6.9.5
gyp ERR! node-gyp -v v3.4.0
gyp ERR! not ok 
npm WARN enoent ENOENT: no such file or directory, open 'C:\Users\CHRIST~1\AppData\Local\Temp\apm-install-dir-11788-138560-1jczk95.jy94ahh0k9\package.json'
npm WARN apm-install-dir-11788-138560-1jczk95.jy94ahh0k9 No description
npm WARN apm-install-dir-11788-138560-1jczk95.jy94ahh0k9 No repository field.
npm WARN apm-install-dir-11788-138560-1jczk95.jy94ahh0k9 No README data
npm WARN apm-install-dir-11788-138560-1jczk95.jy94ahh0k9 No license field.
npm ERR! Windows_NT 10.0.15063
npm ERR! argv "C:\\Users\\Christopher\\AppData\\Local\\atom\\app-1.19.7\\resources\\app\\apm\\bin\\node.exe" "C:\\Users\\Christopher\\AppData\\Local\\atom\\app-1.19.7\\resources\\app\\apm\\node_modules\\npm\\bin\\npm-cli.js" "--globalconfig" "C:\\Users\\Christopher\\.atom\\.apm\\.apmrc" "--userconfig" "C:\\Users\\Christopher\\.atom\\.apmrc" "install" "C:\\Users\\CHRIST~1\\AppData\\Local\\Temp\\d-11788-138560-1wkzwg7.b58ahmpldi\\package.tgz" "--runtime=electron" "--target=1.6.9" "--arch=x64" "--global-style"
npm ERR! node v6.9.5
npm ERR! npm  v3.10.10
npm ERR! node-pty@0.7.0 install: `node scripts/install.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the node-pty@0.7.0 install script 'node scripts/install.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the node-pty package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node scripts/install.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs node-pty
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls node-pty
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR!     C:\Users\CHRIST~1\AppData\Local\Temp\apm-install-dir-11788-138560-1jczk95.jy94ahh0k9\npm-debug.log
npm ERR! code 1


What do you see when you type python --version? Apparently that can cause issues with node-pty


Sorry where do I enter in that command within Atom ?


From a terminal package. You can also do it from the command prompt outside of Atom, and the results should be the same, but for best reliability, checking from within Atom will dispel all doubt about which version Atom can access.

Alternatively: do you have Python installed globally? If not, you should download 2.7, install it, and reopen Atom.


I installed two packages, one called python-debugger the other; run-python-simply. Python-Debugger is more or less what I want or is hoping for in a package to run python code from within Atom.Although when clicking run from within python-debugger; the snippet of code doesn’t run, not sure if this how this package work ?

While, I think run-python-simply needs a source file ?


I haven’t used either of those packages, but I’m more interested in the answer to my last question: do you have Python installed? If not, then none of the aforementioned packages will work.


I have Python 2.7 & 3.6 installed :slight_smile:


I also see this error, I have python 3.5.2 installed. In the documentation for the script-runner package it says to do this before installing the package.
apm config set python $(which python2.7)
I have only been using Atom for a couple of days (BTW, really do like it!) and I don’t know how to execute this command within Atom.


If you want to execute terminal commands from within Atom, you can use one of the terminal packages that don’t require node-pty (like termination). However, it may be faster to execute it from the normal command prompt window.


When running the command you posted, it asked for node.js; which I don’t have installed ? I’m going to check the error outputted within Atom, not sure if that will be today but within the next 48 hrs.

The package python-debugger is how I would like to be able to run Python code, as a console window below the code then execute the code all within Atom, although unless I’m wrong but python-debugger doesn’t do as I want ? :slight_smile: