linux command produce Python OSError: [Errno 2] No such file or directory linux command produce Python OSError: [Errno 2] No such file or directory shell shell

linux command produce Python OSError: [Errno 2] No such file or directory


I hate to answer without knowing the much about the underlying reasons, but I've run into this before with subprocess. The call arguments list really wants a list -- I assume it is looking for an executable with spaces in the name, exactly matching what you enter. Try this instead:

import subprocesssubprocess.call(['traceroute', 'www.yahoo.com'])


import sysimport subprocesssubprocess.call('traceroute -I www.yahoo.com',shell=True)

You can simply do this with shell=True option.