Run-in-terminal Package


#1

I would like to press a shortcut key to run my current (say .py) file in Atom in a new Terminal window.

I downloaded the run-in-terminal package from https://github.com/pohmelie/run-in-terminal but I’m not able to set it up right to run my program. Currently when i press F5, 2 new terminal windows open, one in the directory my file is located, and one running the interactive Python 3 interpreter. I just want one terminal to open in my current directory and execute “python3 myFile.py”.
Below are pictures of my run-in-terminal configuration in Atom, please let me know what I need to change to get this to work. Thanks!


#2

I don’t have the answer and you might have better luck asking in the run-in-terminal repo. This sounds like a package-specific problem.


#3

Ok, I got it to work for a python program. Not sure if it will work with a compiled language, but I will check it out more later. For now, here’s what I did to get my Python program to run. Note that this was tested/done on a Mac.

  1. Write a Python program in Atom. Also include the shebang line at the top, with the path to the interpreter you wish to invoke. (If you don’t know the path to your interpreter, type which <interpreter_name> ex) which python3)

ex program)
#!/usr/local/bin/python3
print("Hi!")

  1. Navigate to the directory the file is in using cd in terminal and then type chmod +x delete.py to make the file executable.

  2. Change the settings in the run-in-terminal package as follows.

  1. With the file open in Atom, press fn-F5 to run your program!

This is a cool package. It’s probably a mix of user error and program error (it doen’t seem to work well on a Mac), but its cool nonetheless and hopefully I will be able to get it to compile, then execute programs written in compiled languages.


#4

I have had great success running this package.


I run it on both my mac and windows machines and have had very little problems. I have no idea if it has all the functionality that you need though. I used to run python virtual enviroments in it and of course use github every day from it.


#5

Cool, I will check it out. Definitely is more popular than run-in-terminal with over 100,000 downloads (vs 6,000). I was looking for a new Terminal window to open and run the current file, but this one looks like it appears in the Atom editor (and doesn’t appear to have a shortcut key to run the file). However, it looks like this one still loads all the .bash_profile initialization files, so it looks like a good option.