我正在尝试连接SVN远程客户端,并在Windows中使用以下python代码获取最新的提交修订:
r = svn.remote.RemoteClient(svnPath)
revNum = str(r.info().get("commit#revision"))
我收到以下错误:
我尝试打印“
svnpath
”和“r
”以确保其正确无误。我得到了预期的正确的远程服务器路径(让我们说“remote_path
”)和“svnpath
”的“< SVN(REMOTE) remote_path>
”。远程SVN需要凭据(UID&PWD)才能访问。但是,我使用此脚本运行的计算机已经具有带有正确凭据的SVN设置。
我是否仍需要在python脚本中指定显式凭据才能访问?如果是这样,那又如何?还是我需要用于SVN的任何其他python软件包?
请帮忙...
最佳答案
到那时您可能已经解决了问题,但是查看代码可能会有所帮助。
类RemoteClient
继承自CommonClient
,其开头是这样的:
class CommonClient(svn.common_base.CommonBase):
def __init__(self, url_or_path, type_, username=None, password=None,
svn_filepath='svn', trust_cert=None, env={}, *args, **kwargs):
super(CommonClient, self).__init__(*args, **kwargs)
...
因此,以下应工作:
import svn.remote
url = "http://server.com:8080/svn/SuperRepo/branches/tool-r20"
client = svn.remote.RemoteClient(url, username="toto", password="SuperPassword")
print(client.info())
关于python - svn.remote.RemoteClient.info : FileNotFoundError: [WinError 2] The system cannot find the file specified,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/47700449/