pexpect and escaping "
joerg.maier at rz.uni-mannheim.de
Tue Sep 9 00:39:56 CEST 2003
i have a problem using python and pexpect module in windows with cygwin:
down a bash command like:
$ rsync --partial -cvaLe "/usr/bin/ssh -o UserKnownHostsFile=/dev/null -o
StrictHostKeyChecking=no" "user at server:path_to_file" "/cygdrive/c/"
it works perfect, but used in pexpect.spawn like :
child = pexpect.spawn(RSYNC_PATH, ['--partial', '--progress', '-cvaLe
"/usr/bin/ssh -o UserKnownHostsFile=/dev/null -o
StrictHostKeyChecking=no"', '"' + myssl.user + '@' + myssl.server + ':' +
source + '" "' + target + '"'], timeout=300)
i got child.before from pexpect that is like:
No such file or directory
Failed to exec "/usr/bin/ssh :
but without " around ssh and options rsync is about to think that -o
UserKnownHostsFile=/dev/null is an rsync option and gives an error. every
masking with \ or \\ or \\\ fails.
Any ideas howto tell pexpect just to pass the first string?
Thank you, Jörg
I am a signature virus.
Please copy me to your .signature file to help me spread.
More information about the Python-list