FileNotFoundError: [WinError 2] python 3.4 post commit hook

FileNotFoundError: [WinError 2] python 3.4 post commit hook

processCommit.py 脚本看起来像:

cmd = 'C:\Program Files\VisualSVN Server\bin\svnlook changed %s -r %s' %   (repo, rev)
Line 15 -->**changed = subprocess.Popen(cmd,stdout=subprocess.PIPE).communicate()[0]**
cmd = 'C:\Program Files\VisualSVN Server\bin\svnlook info %s -r %s' % (repo, rev)

提交后出现的错误:

Error: post-commit hook failed (exit code 1) with output:  
Error: Traceback (most recent call last):  
Error:   File "D:\Repositories\IapAdmin\hooks\processCommit.py", line 15, in <module>  
Error:     changed = subprocess.Popen(cmd,stdout=subprocess.PIPE).communicate()[0]  
Error:   File "C:\Python34\lib\subprocess.py", line 859, in __init__  
Error:     restore_signals, start_new_session)  
Error:   File "C:\Python34\lib\subprocess.py", line 1112, in _execute_child  
Error:     startupinfo)  
Error: FileNotFoundError: [WinError 2] The system cannot find the file specified  

swachand.jambhulkar@pers.state.or.us 周围添加引号:

session.sendmail('swachand.jambhulkar@pers.state.or.us', 'swachand.jambhulkar@pers.state.or.us', msg.as_string())

更新

cmd = 'C:\Program Files\VisualSVN Server\bin\svnlook changed %s -r %s' % (repo, rev)
changed = subprocess.Popen(cmd, stdout=subprocess.PIPE).communicate()[0] # line 15
cmd = 'C:\Program Files\VisualSVN Server\bin\svnlook info %s -r %s' % (repo, rev)

不要使用 \ 作为路径,而是使用 /:

cmd = 'C:/Program Files/VisualSVN Server/bin/svnlook changed %s -r %s' % (repo, rev)