Python 在尝试使用pysvn导出SVN时,如何解决此错误?
我试图使用Python SVN绑定(pysvn)在存储库上进行导出,但遇到以下错误:Python 在尝试使用pysvn导出SVN时,如何解决此错误?,python,svn,pysvn,Python,Svn,Pysvn,我试图使用Python SVN绑定(pysvn)在存储库上进行导出,但遇到以下错误: python: subversion/libsvn_subr/dirent_uri.c:955: svn_dirent_join: Assertion `svn_dirent_is_canonical(base, pool)' failed. Aborted (core dumped) 示例代码为: import pysvn client = pysvn.Client() uri = 'https://svn
python: subversion/libsvn_subr/dirent_uri.c:955: svn_dirent_join: Assertion `svn_dirent_is_canonical(base, pool)' failed.
Aborted (core dumped)
示例代码为:
import pysvn
client = pysvn.Client()
uri = 'https://svn.mycompany.com/myproject/trunk/'
# This works fine
print client.list(uri)
# This crashes with the above error
r = client.export(uri, './temp', force=True)
但是,执行svn导出--forcehttps://svn.mycompany.com/myproject/trunk/
在shell提示符下运行时不会出现问题
我正在使用:
- Python 2.7.3
- 颠覆1.7.5
- CentOS 6.0 x64
有什么想法吗?我尝试使用
svn+ssh://
方案,但得到了相同的错误。这使我相信断言失败实际上可能与repo URI无关。我一时兴起,将导出目录改为/tmp/
,一切正常。我以前尝试使用的目录(/temp
)存在于我的主目录中,该目录位于启用了“root squash”选项的NFS装载上。以前,这会导致奇怪的应用程序问题。Subversion API在内部使用规范URL和路径。您的URL后面有斜杠,这不是标准URL。在调用Subversion API函数之前,请删除尾部斜杠或使用svn_uri_canonicalize()函数对URL进行规范化
您可以在Subversion API文档中找到更多详细信息:
如果尝试使用绝对路径而不是。/temp会怎么样?subversion/libsvn_subr/dirent_uri.c:955行是断言(svn_dirent_是规范的(基,池));所以问题在于路径格式,谢谢你的提示!在我的例子中,我使用了路径以斜杠结尾的
--config dir
选项,该斜杠导致断言失败。