You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Cached decorator doesnt appear to support class methods. This should either be fixed somehow, or if not possible, then needs to be a loud warning in the documentation.
I just spent 1/2 - 1 hr down this rabbit hole, hope no body else has to.
This fails in a very odd way.
If a class method is used to @plugin.cached(), during the run it will appear like caching isnt working. If you restart the run, you will get the error Exception: Corrupted storage file at ...../.functions .
The file exists, and if you try to load it using storage = TimedStorage(filename, file_format, TTL) as in the file xbmcmixin.py you will get the error
(Pdb) TimedStorage(filename, file_format, TTL)
*** ValueError: File not in a supported format
Upon reading the __init__ method, I went with
(Pdb) file = open(filename,rb")
(Pdb) file.seek(0)
(Pdb) import pickle
(Pdb) pickle.load(file)
*** AttributeError: 'module' object has no attribute '<NameOfTheClassOfTheCachedMethod>'
In this case the class was just for organization so I moved this particular method out of the class and it worked just fine after that.
I understand that class instance methods may be impossible to cache between calls, but I feel (given the error, not sure) that even class level methods may not work. Either way this should be made very clear in the documentation
The text was updated successfully, but these errors were encountered:
Cached decorator doesnt appear to support class methods. This should either be fixed somehow, or if not possible, then needs to be a loud warning in the documentation.
I just spent 1/2 - 1 hr down this rabbit hole, hope no body else has to.
This fails in a very odd way.
If a class method is used to @plugin.cached(), during the run it will appear like caching isnt working. If you restart the run, you will get the error
Exception: Corrupted storage file at ...../.functions
.The file exists, and if you try to load it using
storage = TimedStorage(filename, file_format, TTL)
as in the filexbmcmixin.py
you will get the errorUpon reading the
__init__
method, I went withIn this case the class was just for organization so I moved this particular method out of the class and it worked just fine after that.
I understand that class instance methods may be impossible to cache between calls, but I feel (given the error, not sure) that even class level methods may not work. Either way this should be made very clear in the documentation
The text was updated successfully, but these errors were encountered: