Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with Windows/Linux Compatibility? #335

Open
zkalson opened this issue Nov 14, 2024 · 1 comment
Open

Issue with Windows/Linux Compatibility? #335

zkalson opened this issue Nov 14, 2024 · 1 comment

Comments

@zkalson
Copy link

zkalson commented Nov 14, 2024

Hi, I have a large diskcache (~600 GB). I used rsync to sync from my local Windows machine to a Linux VM, and I am getting unusual issues on the VM.

Here's my code:

from diskcache import Cache

path = "path\to\diskcache"

FOUR_TERABYTES = 2**42
HALF_A_KILOBYTE = 2**9
DISKCACHE_SETTINGS = {
    "eviction_policy": "none",
    "size_limit": FOUR_TERABYTES,
    "disk_min_file_size": HALF_A_KILOBYTE,
}
cache = Cache(directory=path, **DISKCACHE_SETTINGS)

search_q = "search_term"
for k in cache.iterkeys():
    if search_q.lower() == k.lower():
        print(k)
        print(cache.get(k))
print(cache.get(search_q))
print(cache[search_q])

The above code works as expected on my local Windows machine. On my Linux machine, the output is:

search_term
None
None
Traceback (most recent call last):
File "/home/username/repo/diskcache_test.py", line 27, in
print(cache[search_q])
~~~~~^^^^^^^^^^
File "/home/username/repo/.venv/lib/python3.11/site-packages/diskcache/core.py", line 1234, in getitem
raise KeyError(key)
KeyError: 'search_term'

In other words, it finds the key (but not the associated non-None value). Then, when directly accessing the key, I get a KeyError.

Any idea what might be going on here?

@zkalson
Copy link
Author

zkalson commented Nov 14, 2024

I was able to resolve using the command offered in #304

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant