wbdata
wbdata copied to clipboard
Unpickling error?
After installing using pip install wbdata
I am getting a pickling error on doing just a simple import wbdata as wb
command:
UnpicklingError Traceback (most recent call last)
<ipython-input-21-08dfa68d526a> in <module>
----> 1 import wbdata as wb
~\Anaconda3\envs\WorldBank\lib\site-packages\wbdata\__init__.py in <module>
4 __version__ = "0.3.0"
5
----> 6 from .api import ( # noqa: F401
7 get_country,
8 get_data,
~\Anaconda3\envs\WorldBank\lib\site-packages\wbdata\api.py in <module>
16
17 from decorator import decorator
---> 18 from . import fetcher
19
20 BASE_URL = "https://api.worldbank.org/v2"
~\Anaconda3\envs\WorldBank\lib\site-packages\wbdata\fetcher.py in <module>
62
63
---> 64 CACHE = Cache()
65
66
~\Anaconda3\envs\WorldBank\lib\site-packages\wbdata\fetcher.py in __init__(self)
40 self.cache = {
41 i: (date, json)
---> 42 for i, (date, json) in pickle.load(cachefile).items()
43 if (TODAY - datetime.date.fromordinal(date)).days < EXP
44 }
UnpicklingError: pickle data was truncated
When I had previously installed this package I remember I did have to restart the kernel for something because it was being too slow. Could something have become corrupted like this? I tried creating a new environment and reinstalling but this didn't work either. Thanks for any help!
Maybe perhaps there is a way of clearing that cache? My guess is that would sort it out?
Yes, that will solve that for now, I'll also open an issue to do it automatically on a failed load. What operating system are you using?
Yep so confirmed I located where the cache was being stored. Deleted the folder, uninstalled the package and reinstalled it and it seems to work. My OS is Windows 10.
It seems that i have the same problem.
File "c:/Users/Administrator/Desktop/wbdatadownload.py", line 1, in
So where can i find the cache being stored? My OS is Windows 7. Many thanks!
@ValeCKalpha Should be at" C:\Documents and Settings<User>\Application Data\Local Settings\wbdata\wbdata", where <User> is your username.
Thanks !
@ValeCKalpha Should be at" C:\Documents and Settings<User>\Application Data\Local Settings\wbdata\wbdata", where is your username.
My Windows runs well now. But my MacOS has the same question just now. I would like to ask where to find the cache in MacOS? Thanks~
@ValeCKalpha "~/Library/Application Support/wbdata"
@ValeCKalpha "~/Library/Application Support/wbdata"
thks