Using Python's subprocess module using PyCall

Why would:

using PyCall
@pyimport as call_prog

result in:

ERROR: LoadError: PyError (:PyImport_ImportModule) <type 'exceptions.ImportError'>
ImportError('No module named call',) is a function, not a module, and @pyimport only works with modules. Just do

call_prog = pyimport("subprocess")["call"]

# then you can do, for example:
call_prog(["ls", "-l"])
call_prog("ls -l", shell=true)
1 Like

That make sense. Thank you very much.