Problem with subproccess in python

Hi guys,

Currently need to use subprocess in order to simulate an attack target. The code causing me an issue is shown below.

if ( name == “main” ) :

Produce a sub-process representing the attack target.

target = subprocess.Popen( args = sys.argv[1],
stdout = subprocess.PIPE,
stdin = subprocess.PIPE )

Whenever I try to execute it within the command prompt I get the following error:

Traceback (most recent call last):
File “./attack.py”, line 152, in
stdin=subprocess.PIPE)
File “/usr/lib/python2.7/subprocess.py”, line 394, in init
errread, errwrite)
File “/usr/lib/python2.7/subprocess.py”, line 1047, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory

If I add shell = True, a different problem occurs.

/bin/sh: 1: 5.D: not found

Where 5.D= argv[1].

Any help would be appreciated

This site is for the co-ordination of the Ubuntu project, and not support.

For Ubuntu Support options, you will find many listed https://community.ubuntu.com/t/finding-help/712 though a [python] programming site may be even more appropriate.