我正在尝试让这个工作,但我一直在
subprocess.call(['c:/cygwin/bin/bash.exe', '--login', '-i', 'rsync', '-zrgo', '--omit-dir-times', '--verbose', '--delete', '.', 'usertwo@192.168.1.1:/var/www/project/'])
-
bash: /usr/bin/rsync: cannot execute binary file
126
答案 0 :(得分:1)
你缺少bash的'-c'(命令)选项。您还应该将rsync命令作为单个字符串提供:
subprocess.call(['c:/cygwin/bin/bash.exe', '--login', '-i', '-c', 'rsync -zrgo --omit-dir-times --verbose --delete . usertwo@192.168.1.1:/var/www/project/'])
从手册页:
-c string If the -c option is present, then commands are read from
string. If there are arguments after the string, they are
assigned to the positional parameters, starting with $0.
例如:
# bash /bin/ls
/bin/ls: /bin/ls: cannot execute binary file
# bash -c "/bin/ls -l"
<ls output>