I am using a Temper1F sensor, the code base I am using is at https://github.com/urwen/temper. The temper.py code returns an out put as seen below.
$ python3 temper.py
Bus 001 Dev 006 413d:2107 TEMPerX_V3.3 22.6C 72.7F - - - -
I would like to take that output and put it as a string variable in a different python script. I have tried using os. How can I invoke the other python script and store the output to variable?
I have tried the following methods:
from subprocess import call
var = str(call(["python", "temper.py"]))
var2 = call(["python", "temper.py"])
import os
os.system('python temper.py')
import temper
var = temper
The call method returns a 0.