导入 python 包时出现 EOF 错误

EOF Error when importing python package

我正在开发一个项目,该项目使用 python 的 wbdata 包,它是世界银行 api 的包装器。它工作正常,直到我做出我猜想的大量数据请求,我不得不取消它,现在当我使用 import wbdata 函数时,包甚至不会加载。这是我得到的

Python 2.7.7 |Anaconda 2.0.1 (64-bit)| (default, Jun 11 2014, 10:40:02) [MSC 

v.1500 64 bit (AMD64)]
Type "copyright", "credits" or "license" for more information.

IPython 2.1.0 -- An enhanced Interactive Python.
Anaconda is brought to you by Continuum Analytics.
Please check out: http://continuum.io/thanks and https://binstar.org
?         -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help      -> Python's own help system.
object?   -> Details about 'object', use 'object??' for extra details.
%guiref   -> A brief reference about the graphical user interface.

In [1]: import wbdata as wb

Traceback (most recent call last):

  File "<ipython-input-1-ae1872a5f07c>", line 1, in <module>
    import wbdata as wb

  File "C:\Users\Josh New\Anaconda\lib\site-packages\wbdata\__init__.py", line 23, in <module>
    from .api import (get_country, get_data, get_dataframe, get_panel,

  File "C:\Users\Josh New\Anaconda\lib\site-packages\wbdata\api.py", line 31, in <module>
    from . import fetcher

  File "C:\Users\Josh New\Anaconda\lib\site-packages\wbdata\fetcher.py", line 104, in <module>
    if not len(CACHE.cache)== 0:

  File "C:\Users\Josh New\Anaconda\lib\site-packages\wbdata\fetcher.py", line 82, in cache
    cache = pickle.load(cachefile)

EOFError


In [2]: 

有人可以帮我让这个包重新工作吗?

谢谢

乔什

编辑- 在 运行 %debug cachefile.name 之后,我得到以下信息;

   %debug cachefile.name
NOTE: Enter 'c' at the ipdb>  prompt to continue execution.
> c:\users\josh new\anaconda\lib\encodings\cp1252.py(15)decode()
     14     def decode(self,input,errors='strict'):
---> 15         return codecs.charmap_decode(input,errors,decoding_table)
     16 


ipdb> c
Traceback (most recent call last):
  File "C:\Users\Josh New\Anaconda\lib\site-packages\IPython\core\magics\execution.py", line 817, in _run_with_debugger
    deb.run(code, code_ns)
  File "C:\Users\Josh New\Anaconda\lib\bdb.py", line 400, in run
    exec cmd in globals, locals
  File "<string>", line 1, in <module>
NameError: name 'cachefile' is not defined

使用ipython的魔法%debug并检查cachefile的文件名是什么。如果它是一个常规文件,名称应该可以作为 cachefile.name.

访问

然后核对那个文件。

我想我已经通过进入 Appdata\Local\wbdata 中的 wbdata 文件夹并删除其中的缓存文件来修复它。现在似乎可以工作了。