Code:
def OptiWrapper(*args):
# execute optimizer program
# list(args) is a no-op, since it is already a list...
ret = call(list(args), shell=True)
return ret
This is BAD.
args is a list, and shell=True
These conditions cannot both be true.
Either use:
Code:
def OptiWrapper(*args):
# execute optimizer program
ret = call(args)
return ret
or
Code:
def OptiWrapper(*args):
# execute optimizer program
# this actually requires a lot more checking of proper shell
# quoting/escaping than I display here
ret = call(' '.join(args), shell=True)
return ret
See the python docs:
https://docs.python.org/3/library/su...en-constructor
Quote:
On POSIX with shell=True, the shell defaults to /bin/sh. If args is a string, the string specifies the command to execute through the shell. This means that the string must be formatted exactly as it would be when typed at the shell prompt. This includes, for example, quoting or backslash escaping filenames with spaces in them. If args is a sequence, the first item specifies the command string, and any additional items will be treated as additional arguments to the shell itself. That is to say, Popen does the equivalent of:
Code:
Popen(['/bin/sh', '-c', args[0], args[1], ...])
|
EDIT: useless nit #2
Why define a special function as a wrapper for subprocess.call, when it is used only once and adds no particular value other than turning on the shell and doing list --> list conversion?
It was staring me in the face while looking at the source of the hanging...