0

I'm trying to run a bash script that runs update and upgrade for me in the terminal window from a Python script, using:

import subprocess

subprocess.call(['bash', '/home/pi/updatescript.sh'])

When I run the python script I see no output in the terminal window like I would if the script were run from there using ./. Is this normal? Or am I doing something wrong?

I tried a few other scripts that I have that use xdotool and they didn't seem to run like they do from terminal either so I am a bit confused.

jgritty
  • 11,660
  • 3
  • 38
  • 60
Lorcank11
  • 137
  • 8
  • you need `check_output` all this will do is return a status code – eagle Mar 06 '18 at 21:53
  • this may help https://stackoverflow.com/questions/4760215/running-shell-command-from-python-and-capturing-the-output – Haifeng Zhang Mar 06 '18 at 21:53
  • Also if it's an executable script, why call bash? Just call the script. – miken32 Mar 06 '18 at 23:43
  • I just wasn't sure if it was running as nothing seemed to happen when I called it and so wanted to see it execute in terminal is all. Check output seems to do the job. Thanks for your help gents. – Lorcank11 Mar 07 '18 at 00:50

0 Answers0