the below code shows attribute error when run the below code. import subprocess import sys import shlex
cmd = 'mtr -nrc30 -s1400 -z'
cmd = shlex.split(cmd)
abc = shlex.split(sys.argv[1])
subprocess.call([cmd,abc])
the error i get is below. What could the possible reason for this, when both the inputs to subprocess are converted to list
AttributeError: 'list' object has no attribute 'rfind'
shlex.split()returns a list. So your argument tosubprocess.call()is a list-of-lists, which is the wrong type.