diff --git a/mapillary_tools/uploader.py b/mapillary_tools/uploader.py index d11a9b14..8b2e2ad3 100644 --- a/mapillary_tools/uploader.py +++ b/mapillary_tools/uploader.py @@ -36,6 +36,7 @@ types, upload_api_v4, utils, + VERSION, ) from .camm import camm_builder, camm_parser from .gpmf import gpmf_parser @@ -799,8 +800,14 @@ def _maybe_create_persistent_cache_instance( LOG.debug("Dry-run mode enabled, skipping caching upload file handles") return None + # Different python/CLI versions use different cache (dbm) formats. + # Separate them to avoid conflicts + py_version_parts = [str(part) for part in sys.version_info[:3]] + version = f"py_{'_'.join(py_version_parts)}_{VERSION}" + cache_path_dir = ( Path(constants.UPLOAD_CACHE_DIR) + .joinpath(version) .joinpath(api_v4.MAPILLARY_CLIENT_TOKEN.replace("|", "_")) .joinpath( user_items.get("MAPSettingsUserKey", user_items["user_upload_token"]) @@ -812,6 +819,7 @@ def _maybe_create_persistent_cache_instance( # Sanitize sensitive segments for logging sanitized_cache_path = ( Path(constants.UPLOAD_CACHE_DIR) + .joinpath(version) .joinpath("***") .joinpath("***") .joinpath("cached_file_handles")