Closed Michael-F-Ellis closed 3 years ago
Very interesting. What happens when you try passing -C
to clear the cache?
Very interesting. What happens when you try passing
-C
to clear the cache?
(base) michaels-mbp mellis % howdoi compute a median -C
Cache cleared successfully
WARNING: Exception raised while handling cache file '/Users/mellis/Library/Caches/howdoi/4fa5b1a565c963cedff6908a65955151'
Traceback (most recent call last):
File "/Users/mellis/miniconda3/lib/python3.6/site-packages/cachelib/file.py", line 162, in get
with open(filename, "rb") as f:
FileNotFoundError: [Errno 2] No such file or directory: '/Users/mellis/Library/Caches/howdoi/4fa5b1a565c963cedff6908a65955151'
WARNING: Exception raised while handling cache file '/Users/mellis/Library/Caches/howdoi/067fffb18193d8a3a55b439ecda0d0fb'
Traceback (most recent call last):
File "/Users/mellis/miniconda3/lib/python3.6/site-packages/cachelib/file.py", line 162, in get
with open(filename, "rb") as f:
FileNotFoundError: [Errno 2] No such file or directory: '/Users/mellis/Library/Caches/howdoi/067fffb18193d8a3a55b439ecda0d0fb'
WARNING: Exception raised while handling cache file '/Users/mellis/Library/Caches/howdoi/20d6d5d60064cc48785e0a2d5f48da55'
Traceback (most recent call last):
File "/Users/mellis/miniconda3/lib/python3.6/site-packages/cachelib/file.py", line 162, in get
with open(filename, "rb") as f:
FileNotFoundError: [Errno 2] No such file or directory: '/Users/mellis/Library/Caches/howdoi/20d6d5d60064cc48785e0a2d5f48da55'
function median(values){
if(values.length ===0) return 0;
values.sort(function(a,b){
return a-b;
});
var half = Math.floor(values.length / 2);
if (values.length % 2)
return values[half];
return (values[half - 1] + values[half]) / 2.0;
}
You may want to check and see what the permissions are for /Users/mellis/Library/Caches/howdoi/
Does it exist? Can you write to it?
If it exists but you can't write to it you'll want to change the permissions for that directory.
You may want to check and see what the permissions are for
/Users/mellis/Library/Caches/howdoi/
(base) michaels-mbp mellis % ls -la /Users/mellis/Library/Caches/howdoi total 568 drwxr-xr-x 6 mellis staff 192 Aug 13 12:23 . drwx------+ 124 mellis staff 3968 Aug 12 10:54 .. -rw------- 1 mellis staff 934 Aug 13 12:23 067fffb18193d8a3a55b439ecda0d0fb -rw------- 1 mellis staff 17 Aug 13 12:23 2029240f6d1128be89ddc32729463129 -rw------- 1 mellis staff 276387 Aug 13 12:23 20d6d5d60064cc48785e0a2d5f48da55 -rw------- 1 mellis staff 395 Aug 13 12:23 4fa5b1a565c963cedff6908a65955151
Does it exist?
yes
Can you write to it?
yes
In case I wasn't clear in my previous posts, howdoi works as expected with previously cached answers, e.g.
(base) michaels-mbp mellis % howdoi compute a median
function median(values){
if(values.length ===0) return 0;
values.sort(function(a,b){
return a-b;
});
var half = Math.floor(values.length / 2);
if (values.length % 2)
return values[half];
return (values[half - 1] + values[half]) / 2.0;
}
The WARNINGs are apparently coming from cachelib and aren't caught by howdoi.
(base) michaels-mbp mellis % python
Python 3.6.8 |Anaconda, Inc.| (default, Dec 29 2018, 19:04:46)
[GCC 4.2.1 Compatible Clang 4.0.1 (tags/RELEASE_401/final)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import cachelib
>>> fc = cachelib.FileSystemCache("/tmp/fc")
>>> fc.add("foo", "bar")
True
>>> fc.get("foo")
'bar'
>>> fc.get("gnorf")
WARNING:root:Exception raised while handling cache file '/tmp/fc/12c4852455fe1c69e87bbc69e58c507c'
Traceback (most recent call last):
File "/Users/mellis/miniconda3/lib/python3.6/site-packages/cachelib/file.py", line 162, in get
with open(filename, "rb") as f:
FileNotFoundError: [Errno 2] No such file or directory: '/tmp/fc/12c4852455fe1c69e87bbc69e58c507c'
Very odd. I haven't seen this before. Does the same issue happen on a newer version of Python (3.9.2?)
I see that cachelib also released an update recently to 0.3.0 - perhaps we need to bump that version https://github.com/pallets/cachelib/releases/tag/0.3.0
I would accept a PR to catch that error if we aren't able to solve it with newer versions.
Very odd. I haven't seen this before. Does the same issue happen on a newer version of Python (3.9.2?)
I see that cachelib also released an update recently to 0.3.0 - perhaps we need to bump that version
(base) michaels-mbp mellis % python --version Python 3.9.2 (base) michaels-mbp mellis % pip install cachelib Requirement already satisfied: cachelib in ./miniconda3/lib/python3.9/site-packages (0.3.0)
(base) michaels-mbp mellis % howdoi remove a symlink WARNING: Exception raised while handling cache file '/Users/mellis/Library/Caches/howdoi/b5230b1fc5de98de7d5b2515ac17eff3' Traceback (most recent call last): File "/Users/mellis/miniconda3/lib/python3.9/site-packages/cachelib/file.py", line 162, in get with open(filename, "rb") as f:
etc, etc ...
>
> I would accept a PR to catch that error if we aren't able to solve it with newer versions.
I'd gladly take that on, but I'm running behind on other projects at the moment. In the meantime, I'll work around it by setting HOWDOI_DISABLE_CACHE.
BTW, thanks for creating and maintaining this clever and extremely useful utility!
I still have this same error/warning (I installed the newest howdoi-git via aur)
Posting the output below
~
❯ howdoi install gnome tweaks
WARNING: Exception raised while handling cache file '/home/sheep/.cache/howdoi/14a47b6894076c57a181e86c1c4ccef9'
Traceback (most recent call last):
File "/home/sheep/.local/lib/python3.9/site-packages/cachelib/file.py", line 162, in get
with open(filename, "rb") as f:
FileNotFoundError: [Errno 2] No such file or directory: '/home/sheep/.cache/howdoi/14a47b6894076c57a181e86c1c4ccef9'
WARNING: Exception raised while handling cache file '/home/sheep/.cache/howdoi/7d25e5a49d5ce56b55e009f620c89baa'
Traceback (most recent call last):
File "/home/sheep/.local/lib/python3.9/site-packages/cachelib/file.py", line 162, in get
with open(filename, "rb") as f:
FileNotFoundError: [Errno 2] No such file or directory: '/home/sheep/.cache/howdoi/7d25e5a49d5ce56b55e009f620c89baa'
sudo apt install gnome-tweaks
Same here!
howdoi for loop python
WARNING: Exception raised while handling cache file '/Users/inespereira/Library/Caches/howdoi/3d529430b256b3739e4f940f8192375d'
Traceback (most recent call last):
File "/Users/inespereira/Library/Python/3.8/lib/python/site-packages/cachelib/file.py", line 162, in get
with open(filename, "rb") as f:
FileNotFoundError: [Errno 2] No such file or directory: '/Users/inespereira/Library/Caches/howdoi/3d529430b256b3739e4f940f8192375d'
WARNING: Exception raised while handling cache file '/Users/inespereira/Library/Caches/howdoi/c8cd71e640c957db367486307e244085'
Traceback (most recent call last):
File "/Users/inespereira/Library/Python/3.8/lib/python/site-packages/cachelib/file.py", line 162, in get
with open(filename, "rb") as f:
FileNotFoundError: [Errno 2] No such file or directory: '/Users/inespereira/Library/Caches/howdoi/c8cd71e640c957db367486307e244085'
WARNING: Exception raised while handling cache file '/Users/inespereira/Library/Caches/howdoi/08686ad756e0af7c39d0cf9a9d27db23'
Traceback (most recent call last):
File "/Users/inespereira/Library/Python/3.8/lib/python/site-packages/cachelib/file.py", line 162, in get
with open(filename, "rb") as f:
FileNotFoundError: [Errno 2] No such file or directory: '/Users/inespereira/Library/Caches/howdoi/08686ad756e0af7c39d0cf9a9d27db23'
mylist = [1,2,3]
for item in mylist:
print item
mydict = {1:'one', 2:'two', 3:'three'}
for key in mydict:
print key, mydict[key]
Anyone have an idea why this started happening recently? I can merge in what @benjaminhafen did in #422 but it's odd that we have to manually change the log level.
This is fixed in 2.0.18!
This is fixed in 2.0.18!
Confirmed, did a reinstall of the howdoi-git
package on the AUR and it doesn't throw out cache errors!
Same here! Thank you! 🤩
What happens:
Enter a new query:
What you expected to happen:
Show the answer only.
Output with
--explain
Please provide the output of running the same command with the
--explain
flag like so