-
Notifications
You must be signed in to change notification settings - Fork 18
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
'str' object has no attribute 'decode' #76
base: master
Are you sure you want to change the base?
Conversation
I am trying to use user caching, after setting "cache-storage=db" I am getting File "/usr/lib/python3/dist-packages/xclib/utf8.py", line 19, in unutf8 return u.decode('utf-8', opts) AttributeError: 'str' object has no attribute 'decode' It seems like the object is already decoded. With this fix I was able to successfully enable user caching.
Codecov Report
@@ Coverage Diff @@
## master #76 +/- ##
==========================================
- Coverage 78.01% 77.98% -0.04%
==========================================
Files 18 18
Lines 928 931 +3
==========================================
+ Hits 724 726 +2
- Misses 204 205 +1
Continue to review full report at Codecov.
|
try: | ||
return u.decode('utf-8', opts) | ||
except AttributeError: | ||
pass |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't this be return u
instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably yes,
but I am not familiar with the code and I thought there could be cases where the object is not already decoded.
If that's not the case, then return u
sounds like the most logical approach :-)
Thanks for the PR. This triggered me to notice that I had disabled caching some time ago. I will reenable it and try to reproduce the problem (and add a test case). At first glance, it looks like there should be a Also, during the refactoring, clearly distinguishing between Would you like to try this? |
I am trying to use user caching, after setting "cache-storage=db" I am getting
It seems like the object is already decoded.
With this fix I was able to successfully enable user caching.