gpt4 book ai didi

python - pysvn.ClientError : WC locked with sqlite attempt to write a readonly database during checkout to a same directory in the second time

转载 作者:太空宇宙 更新时间:2023-11-04 11:45:55 24 4
gpt4 key购买 nike

我尝试使用一个临时目录来重复 check out 和删除,如下所示:

client = pysvn.Client()
url = "..."
path = "\tmp\temp_dir"

client.checkout(url, path) # it's ok here

# clear dir and checkout again
shutil.rmtree(path)
os.makedirs(path) # ok until here

assert not os.listdir(path)
client.checkout(url, path) # EXCEPTION!

在执行最后一行时,它引发异常pysvn.ClientError: Working copy '/tmp/temp_dir' locked with additional errors:sqlite[S8]: attempt to write a readonly database .

我尝试在终端中使用 svn checkou 结帐,它工作正常。但即使在我删除了命令行 check out 的文件之后,我仍然无法通过 pysvn 在代码中 check out 相同的异常。

一些附加信息:

  • 我在 Linux 上使用 python3.4 和 pysvn 1.8.0。
  • 在 Windows 上使用 python3.5 和 pysvn 1.9.9 不会触发同样的问题。

谁能帮我解决这个问题?

问候

最佳答案

我通过获取一个新的 pysvn.Client 实例解决了这个问题。换句话说,通过使用以下代码:


client = pysvn.Client()
client.checkout(url, path) # it's ok here

# clear dir and checkout again
shutil.rmtree(path)
os.makedirs(path) # ok until here
assert not os.listdir(path)

client = pysvn.Client() # obtain another instance
client.checkout(url, path) # ok

pysvn.Client 实例中似乎缓存了一些信息,使我无法再次结账,但我不知道为什么。

关于python - pysvn.ClientError : WC locked with sqlite attempt to write a readonly database during checkout to a same directory in the second time,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57788474/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com