I am using python 2.7
cmd = "sudo start service/newservice db=temp"
p = subprocess.Popen(shlex.split(cmd), stderr=subprocess.STDOUT)
Above command works fine and intented process is spawned.
cmd = "sudo stop service/newservice db=temp"
p = subprocess.Popen(shlex.split(cmd), stderr=subprocess.STDOUT)
In the same file when above is called. It gives error.
traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.7/subprocess.py", line 672, in __init__
errread, errwrite)
File "/usr/lib/python2.7/subprocess.py", line 1213, in _execute_child
raise child_exception
TypeError: must be encoded string without NULL bytes, not str