platformdirs 4.7.0 throws FileNotFoundError on Windows when USERPROFILE points to a directory without AppData\Local. In 4.6.0 it just returns a nonexistent path.
import os
import tempfile
os.environ["USERPROFILE"] = tempfile.mkdtemp()
from platformdirs import user_cache_dir
print(user_cache_dir("myapp"))
# platformdirs 4.6.0: prints ".\myapp\myapp\Cache"
# platformdirs 4.7.0: FileNotFoundError: [WinError -2147024893]
This is most likely caused by PR #380, because SHGetKnownFolderPath verifies the folder's existence by default. So the easiest fix would probably be to pass KF_FLAG_DONT_VERIFY.