I'm trying to pass some data from a python program to a shell script. I understand one option is to "call" the shell script from within the python program. I have tried the following but I'm getting an error.
Code: Select all
#Python 2.7.9 (default, Mar 8 2015, 00:52:26)
#[GCC 4.9.2] on linux2
#Type "copyright", "credits" or "license()" for more information.
#!/bin/python
#program to read temp.txt file and deliver...
f = open('/var/www/axx/temp.txt')
line1 =f.readline()
line2=f.readline()
f.close()
print 'line1',line1
print 'line2',line2
call(['bash', 'overlayv2.sh', line1, line2])
line1 11/15/2016 05:15:00 PM
line2 50.0F
Traceback (most recent call last):
File "/home/pi/axx/datatransv1.0.py", line 32, in <module>
call(['bash', 'overlayv2.sh', line1, line2, line3])
NameError: name 'call' is not defined
>>>
Can someone explan what I'm doing wrong?
Also, If there is a better (easrer) way I'm all ears!
THANKS FOR ANY HELP!!!