sen2cor error: could not delete *.xml


recently I’ve been getting an error when running sen2cor on a Sentinel-2 scene, I’m just post the last part of it:

File "..\Anaconda\Lib\distutils\", line 41, in _copy_file_contents
    "could not delete '%s': %s" % (dst, errstr))
distutils.errors.DistutilsFileError: could not delete '[S2A_USER_Granule].xml' [Because it is used by another process]

The important part is “used by another process” (rough translation).
I can restart sen2cor and continue the processing until the next error pops up.

Any suggestions how I can solve this?

Does nobody encouter the same error?
My current workaround is to loop the sen2cor command 10 times, after that the image is usually fully processed.

This happened to me. I have created an issue on the github repo.

should have searched better

The workaround by @ChristianSeverin is already implemented.