Run $Path command in Terminal in a python script

refle

i use ipython notebook and I want to call a terminal command: fft <in> <out>

my "fft" is in my $PATH so using a terminal, this would work.

How can I run this command in my ipython notebook?


the problem is that my fft executable is in my $PATH folder, and python won't recognize this

refle

Found the solution:

import os    
os.system("xterm -e 'bash -c \"fft -i 3 AddedK AddedK_ifft; exit -f exec bash\"' ")

xterm opens a new terminal

fft ...; calls the function fft

exit -f closes the terminal

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

run a python script in terminal without the python command

How to run a terminal command inside a python script?

fdisk command run on terminal but not run with ruby script

Cannot run '>' for a terminal command in python

open terminal run command python

Run Python script on Mac terminal

Run terminal command (python command) at start up

script to open terminal, run command and keep terminal open

Run a python script from the python terminal in Python

How to run python script in linux terminal console and continue using command line?

How to load Python script and run custom code from the terminal in the single command?

Changing default path of Run Python File in Terminal

Open the terminal in python and run a python script

Python Script To Run Bash command

Python: Run command for another software in terminal

How to run python file on terminal command line

Run a terminal command at python without show the result

How to run a python script in a terminal upon login?

How to run python script on terminal (ubuntu)?

Run a Python script when opening Terminal(xterm)

Trying to run my python script in terminal

How to execute a command in the terminal from a Python script?

How to add a python script as a terminal command?

Run docker run command in python script

How to run a .sh-script from any path in a terminal?

Run Python script on Terminal and keep using the terminal afterwards

Execute a terminal command that takes an argument from terminal in python a 2.6 script

babel command converts when run in terminal but running the script ends in error

Bash script how to run a command remotely and then exit the remote terminal