0

I'm using Jupyter Notebook and python 3.8. Depending on other variables, I will generate a txt file with the command that must be entered (literally) on the command line. For example: topup --imain potato. This command is in the txt file as a line. I want to run this command as if in the cmd. I also want to do all of this from Jupyter Notebook and have some output to know what is going on.

Is it possible? I also accept other ways to do this (I'm trying to automate an FSL procedure).

Paul
  • 57
  • 6
  • Does this answer your question? [Calling an external command from Python](https://stackoverflow.com/questions/89228/calling-an-external-command-from-python) – AMC Feb 18 '20 at 17:44
  • This might also be helpful for other people: > cmd= 'python '+'"'+main+sep+'run_py.txt'+'"' >lasito=subprocess.Popen(cmd,stdout=subprocess.PIPE,shell=True) >out, err = lasito.communicate() – Paul Feb 19 '20 at 08:54

0 Answers0