diff --git a/swh/loader/core/utils.py b/swh/loader/core/utils.py --- a/swh/loader/core/utils.py +++ b/swh/loader/core/utils.py @@ -25,6 +25,7 @@ if not os.path.exists(dirpath): return for filename in os.listdir(dirpath): + path_to_cleanup = os.path.join(dirpath, filename) try: # pattern: `swh.loader.svn-pid.{noise}` if ( @@ -37,7 +38,6 @@ if log: log.debug("PID %s is live, skipping" % pid) continue - path_to_cleanup = os.path.join(dirpath, filename) # could be removed concurrently, so check before removal if os.path.exists(path_to_cleanup): shutil.rmtree(path_to_cleanup)