What is the proper way to pass values of string variables to Popen function in Python? I tried the below piece of code
var1 = 'hello'
var2 = 'universe'
p=Popen('/usr/bin/python /apps/sample.py ' + '"' + str(eval('var1')) + ' ' + '"' + str(eval('var2')), shell=True)
and in sample.py, below is the code
print sys.argv[1]
print '\n'
print sys.argv[2]
but it prints the below output
hello universe
none
so its considering both var1 and var2 as one argument. Is this the right approach of passing values of string variables as arguments?
str(eval('var1'))is the same as'var1'.