Terminal doesn't open window on top Mac - Atom - python-3.x

I am currently using Atom to code in Python3 on my Mac and I have a package installed ("atom-python-run") which launches a terminal window with the command "python3 {path}" with 'path' being the current working directory with filename.py included. It opens just fine and runs perfectly, but the window doesn't open on top of my atom window but behind it instead. I have to click it every time to see the terminal window and it's really frustrating. I also hate using CMD+Tab to find it as well.
This is a bug in the package I'm using (I think) and I don't want to wait for them to fix it. Are there any methods in OS X to ALWAYS open Terminal on top of every other window? Or a third-party application? I can't find a solution to this problem anywhere online.

If you install the scripts package and use it, the output will be written to a window in the Atom application and will be shown at completion. Go to the Atom package page and search for the word script. You should get a hit on the "script" package. Install this package by just clicking on the install button and then open Atom and the python script you wish to run. Now in Atom go to the packages menu item and from that menu select "script". You'll be given several options, choose "run script" and your script should run showing the output in a window at the bottom of the Atom window.

Related

Script that opens cmd from spyder

I am working on a text adventure with python and the issue i am having is getting spyder to open a interactive cmd window. so far i have tried os.systems('cmd / k') to try and open this which it did but i could not get any code to run and kept getting an app could not run this file error. my current code runs off a import module that pulls the actual adventure from another source code file. how can i make it to where only one file runs and opens the cmd window to play the text adventure?
(Spyder maintainer here) Cmd windows are hidden by default because there are some packages that open lot of them while running code (e.g. pyomo).
To change this behavior, you need to go to
Tools > Preferences > IPython console > Advanced settings > Windows adjustments
and deactivate the option called Hide command line output windows generated by the subprocess module.
I found myself in a similar situation, developing code for a research group with heavy Spyder usage. I came up with this workaround to force usage of the vanilla Popen class regardless of whether or not it is run from Spyder (full disclosure I have not tested it very aggressively):
import subprocess
try:
from spydercustomize import SubprocessPopen
except ImportError:
SubprocessPopen = subprocess.Popen
else:
SubprocessPopen = SubprocessPopen.__bases__[0]
process = SubprocessPopen()

How to configure Atom script to run main.py

I recently started used Atom IDE. It feels good. The only thing that I find difficult is to setup a project profile to run. In pycharm there is Run configuration, is there something similar to it in Atom ?
I have a project with multiple classes. When ever I want to run my script,I have to go to the main.py to launch 'ctrl + i'.
Could any one help me to setup the project in a such a way, when I execute 'ctrl + i' it automatically launch's main.py instead of the py file I am calling from.
In order to run a python script in tha Atom IDE, you can either press Ctrl+Shift+B or install a package called "terminal-tab" (https://atom.io/packages/terminal-tab). This package in an integrated command prompt like cmd on windows.
In the top bar, under "packages", go to "script", and select "configure script".
There put in the directory in which the program is, what command to run (python3 main.py), and select "save as profile." The window explains itself.
Then, you should be able to run from that profile with Alt+Ctrl+Shift+B, from whatever tab you're on.

How to open command prompt in Atom editor?

How can I run command prompt in Atom Editor? Do I need to install any package for the same? I could not find any videos or links regarding this issue.
Go to File -> Settings -> Install
Search for package -> platformio-ide-terminal
After installation of this package
Go to Packages tab in a menu bar where you can see all the packages installed
click on platformio-ide-terminal -> New Terminal [Now you will get the terminal window]
There are 2 packages that I use to open a terminal window in Atom. They are 'platformio-ide-terminal' and Termination. Load either one of these and the name will appear under the package menu. Selecting either one will allow you to open a terminal window in bottom third of Atom window.

PyCharm does not find pygame [duplicate]

I've downloaded pygame-1.9.1release.tar.gz from the Pygame website. I extracted and installed it and it's working fine in the command line Python interpreter in Terminal (Ubuntu). But I want to install it for some IDE, like PyCharm. How can I do it?
Well, you don't have to download it for PyCharm here. You probably know how it checks your code. Through the interpreter! You don't need to use complex command lines or anything like that. You need to is:
Download the appropriate interpreter with PyGame included
Open your PyCharm IDE (Make sure it is up to date)
Go to File
Press Settings (Or Ctrl + Alt + S)
Double click on the option that looks like Project: Name_of_Project
Click on Project Interpreter
Choose the interpreter you want to use that includes PyGame as a module
Save your options
And you are ready to go! Here is an alternate (I have never done this, please try to test it)
Add PyGame in the same folder as your PyCharm file (Your PyCharm stuff is always in
a specific file placed by you during installation/upgrade)
Please consider putting your PyCharm stuff inside a folder for easy access.
I hope this helps you!
For PyCharm 2017 do the following:
File - Settings
Double click on your project name
Select Project Interpreter
Click on green + button on the right side of the window
Type Pygame in search window
Click Install package.
Not I'm saying that the answers above won't work, but it might be frustrating to a newbie to do command line magic.
If you are using PyCharm and you are on a Windows 10 machine use the following instructions:
Click on the Windows start menu and type cmd and click on the Command Prompt icon.
Use the command pushd to navigate to your PyCharm project which should be located in your user folder on the C:\ drive. Example: C:\Users\username\PycharmProjects\project name\venv\Scripts.
(If you are unsure go to the settings within PyCharm and navigate to the Python Interpreter settings. This should show you the file path for the interpreter that your project is using. Credit to Anthony Pham for instructions to navigate to interpreter settings.)
HINT: Use copy and paste in the command prompt to paste in the file path.
Use the command pip install pygame and the pip program will handle the rest for you.
Restart you Pycharm and you should now be able to import pygame
Hope this helps. I had a fun time trying to find out the correct way to get it installed, so hopefully this helps someone out in the future.
I just figured it out!
Put the .whl file in C:\Program Files\Anaconda3
While in the folder, click on the blue File tab in the upper left corner of the Window Explorer (assuming you're using Windows)
Click on Open Windows PowerShell as administrator
Write or just copy and paste: py -m pip install pygame
It should start installing
Done!
I hope it works for you. I know it did for me.
I already had pygame installed with python38-32
since its working just fine with it. I used this version of python us my project interpreter.
1.File -settings
2.according to your settings look for project interpreter
3.click on your current project interpreter and click on the add symbol
4.choose system interpreter
5.select the python version thats works with pygame for you
6.Note: some versions of pygame don't work with some versions of python be sure
of what are you doing.
7.hope it works.

How to run a program in Atom Editor?

I found Atom editor as good free alternative to Sublime text editor. Not able to find a straightforward way to run a program in Atom editor. In my case, I am trying to run a java program. Please let me know if it's possible? If yes, please describe the steps to follow.
I find the Script package useful for this. You can download it here.
Once installed you can run scripts in many languages directly from Atom using cmd-i on Mac or shift-ctrl-b on Windows or Linux.
Click on Packages --> Commmand Palette --> Select Toggle.
Type Install Packages and Themes.
Search for Script and then install it.
Press Command + I to run the code (on Mac)
You can go settings, select packages and type atom-runner there if your browser can't open this link.
To run your code do Alt+R if you're using Windows in Atom.
For C/C++ programs there's very good package gpp-compiler.
Shortcuts:
To compile and run: F5
To debug: F6
If you know how to launch your program from the command line then you can run it from the platformio-ide-terminal package's terminal. See platformio-ide-terminal provides an embedded terminal within the Atom text editor. So you can issue commands, including commands to run your Java program, from within it. To install this package you can use APM with the command:
$ apm install platformio-ide-terminal --no-confirm
Alternatively, you can install it from the command palette with:
Pressing Ctrl+Shift+P. I am assuming this is the appropriate keyboard shortcut for your platform, as you have dealt ith questions about Ubuntu in the past.
Type Install Packages and Themes.
Search for the platformio-ide-terminal.
Install it.
This package in Atom can run scripts.
Atom script package
press Alt+X for the running script.
For running javascript you need to install 'node js'
Also pressing ctrl+shift+i in atom gives developer option like chrome
you can test javascript code side by side in atom editor.
In order to get this working properly on Windows, you need to manually set the path to the JDK (...\jdk1.x.x_xx\bin) in the system environment variables.
You can try to use the runner in atom
Hit Ctrl+R (Alt+R on Win/Linux) to launch the runner for the active window.
Hit Ctrl+Shift+R (Alt+Shift+R on Win/Linux) to run the currently selected text in the active window.
Hit Ctrl+Shift+C to kill a currently running process.
Hit Escape to close the runner window
You can run specific lines of script by highlighting them and clicking shift + ctrl + b
You can also use command line by going to the root folder and writing:
$ node nameOfFile.js

Resources