Он запускается в командной строке. Но если вы будете называть его через subprocess
(так будет с conn.modules.subprocess
), это даст вам ошибки как:
>>> subprocess.check_call(['file', '`which python`'])
`which python`: cannot open ``which python`' (No such file or directory)
Потому что в оболочке, это будет выполнено, как:
mquadri$ file '`which python`'
`which python`: cannot open ``which python`' (No such file or directory)
Но вы хотите, чтобы запустить его как:
mquadri$ file `which python`
/usr/bin/python: Mach-O universal binary with 2 architectures
/usr/bin/python (for architecture i386): Mach-O executable i386
/usr/bin/python (for architecture x86_64): Mach-O 64-bit executable x86_64
для того, чтобы сделать вышеуказанную команду бежать, передать его в качестве строки в check_call
с shell=True
как:
>>> subprocess.check_call('file `which python`', shell=True)
/usr/bin/python: Mach-O universal binary with 2 architectures
/usr/bin/python (for architecture i386): Mach-O executable i386
/usr/bin/python (for architecture x86_64): Mach-O 64-bit executable x86_64