提问人:nerd 提问时间:7/18/2023 最后编辑:nerd 更新时间:7/18/2023 访问量:42
未找到回溯存储库错误的异常处理
Exception Handling with Traceback Repo not Found Error
问:
我希望 Python 处理 OSError 的异常,并且找不到存储库,我怎样才能正确完成此操作?Traceback
这是我的代码。
try:
os.mkdir(res)
print("cloning")
repo = git.Repo.clone_from(item['href'], to_path = res)
except OSError, Exception:
continue
这是我希望python处理的例外。
Traceback (most recent call last):
File "test.py", line 34, in <module>
repo = git.Repo.clone_from(item['href'], to_path = res)
File "/home/abc/.local/lib/python2.7/site-packages/git/repo/base.py", line 1020, in clone_from
return cls._clone(git, url, to_path, GitCmdObjectDB, progress, multi_options, **kwargs)
File "/home/abc/.local/lib/python2.7/site-packages/git/repo/base.py", line 966, in _clone
finalize_process(proc, stderr=stderr)
File "/home/abc/.local/lib/python2.7/site-packages/git/util.py", line 333, in finalize_process
proc.wait(**kwargs)
File "/home/abc/.local/lib/python2.7/site-packages/git/cmd.py", line 412, in wait
raise GitCommandError(self.args, status, errstr)
git.exc.GitCommandError: Cmd('git') failed due to: exit code(128)
cmdline: git clone -v https://anonscm.debian.org/git/pkg-fedora-ds/389-console.git 389-console
stderr: 'Cloning into '389-console'...
fatal: repository 'https://anonscm.debian.org/git/pkg-fedora-ds/389-console.git/' not found
'
非常感谢任何指导。
答: 暂无答案
评论
GitCommandError
GitCommandError
GitCommandError