Skip to content Skip to sidebar Skip to footer

Why Doesn't This Subprocess.check_call() Work?

I'm running these snippets with Python 2.7 on Ubuntu 12. import subprocess args = ['rsync', '--rsh='ssh'', '/tmp/a/', '127.0.0.1:/tmp/b/'] subprocess.check_call(args) Fails import

Solution 1:

Remove the quotes around ssh; the shell would normally have parsed those and passed on the argument without the quoting:

import subprocess
args = ['rsync', '--rsh=ssh', '/tmp/a/', '127.0.0.1:/tmp/b/']
subprocess.check_call(args)

Post a Comment for "Why Doesn't This Subprocess.check_call() Work?"