Trac 提交后脚本出现问题(SyntaxError:语法无效)
我已经设置了一个提交后脚本,位于 http:// trac.edgewall.org/browser/trunk/contrib/trac-post-commit-hook 将变更集与票证关联
当我尝试提交时,出现以下错误
“提交后”挂钩失败并出现错误输出:
文件“/var/www/svn/repo/hooks/trac-post-commit-hook”,第 101 行
(选项, args) = parser.parse_args(sys.argv[1:])
^ 语法错误:语法无效
我在 CentOS 上运行 Python 2.4.3。
我对 Python 不熟悉,所以我无法真正判断这里发生了什么,而且之前似乎没有人遇到过这个问题(根据 Google 的说法)。
我希望这里有人知道发生了什么事。
提前致谢。
编辑:
如果有帮助,这是我的提交后脚本
REPOS=“$1”
REV="$2"
LOG='/usr/bin/svnlook log -r $REV $REPOS'
AUTHOR='/usr/bin/svnlook 作者 -r $REV $REPOS'
TRAC_ENV="/var/www/trac/[xxx]/"
TRAC_URL='http://trac.[xxx].com/'
/usr/bin/python /var/www/svn/repo/hooks/trac-post-commit-hook -p "$TRAC_ENV" -r "$REV" -u "$AUTHOR" -m "$LOG" -s “$TRAC_URL”
I've setup a post commit script found at http://trac.edgewall.org/browser/trunk/contrib/trac-post-commit-hook to associate changesets with tickets
When I try to commit, I get the following error
'post-commit' hook failed with error output:
File "/var/www/svn/repo/hooks/trac-post-commit-hook", line 101
(options, args) = parser.parse_args(sys.argv[1:])
^
SyntaxError: invalid syntax
I'm running Python 2.4.3 on CentOS.
I'm not familiar with Python, so I can't really tell whats happening here and no one seems to have had this issue before (according to Google).
I was hoping someone here would know what's going on.
Thanks in advance.
EDIT:
If it helps, here is my post-commit script
REPOS="$1"
REV="$2"
LOG='/usr/bin/svnlook log -r $REV $REPOS'
AUTHOR='/usr/bin/svnlook author -r $REV $REPOS'
TRAC_ENV="/var/www/trac/[xxx]/"
TRAC_URL='http://trac.[xxx].com/'
/usr/bin/python /var/www/svn/repo/hooks/trac-post-commit-hook -p "$TRAC_ENV" -r "$REV" -u "$AUTHOR" -m "$LOG" -s "$TRAC_URL"
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
可能是你前面有空格或制表符(选项,参数)?可能是这样的。
May be you have space or tab before (options,args)? may be like this.
哇,这很奇怪。该行绝对是有效的语法,并且 Python 版本也应该不是问题,因为该脚本的版权声明与 Python 2.4 发布的年份相同。您的计算机上是否安装了多个 Python?如果是这样,您可以检查
/usr/bin/env python
是否返回正确的值?Wow, that is weird. The line is definitely valid syntax, and the Python version should also not be a problem since the script's copyright statement has the same year Python 2.4 was released in. Do you have multiple Python installations on your machine? If so, can you check whether
/usr/bin/env python
returns the correct one?