I tried to use a temp directory for repeated checkout and remving, like follow:

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!

with last line excute, it raise an exception pysvn.ClientError: Working copy '/tmp/temp_dir' locked with additional errors:sqlite[S8]: attempt to write a readonly database.

I tried to checkout in terminal with svn checkou and it works fine. But even after I remove the files checkouted by command line, I still CANNOT checkout by pysvn in code with same exception.

Some additional information:

  • I use python3.4 with pysvn 1.8.0 on linux.
  • Using python3.5 with pysvn 1.9.9 on Windows does not trigger same problem.

Could anyone help me figure out the problem?

Regards

1

There are 1 best solutions below

0
fateflame On

I solved this problem by obtaining a new pysvn.Client instance. In the other word, by using following code:


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

It seems that there is some information cached in a pysvn.Client instance that stopped me from checkout again but I don't know why.