Shove failing because of pretty basic ld vs. optimize issue in stuf.util

纵饮孤独 提交于 2020-01-05 05:56:39

问题


I ran against another issue with shove (see Shove knowing about an object but unable to retrieve it ), but this time I've got a pretty simple repro showing why the dump/load doesn't work.

Looking at the def in C:\Python27\lib\site-packages\shove-0.5.0-py2.7.egg\shove\base.py for loads/dumps, it refers to ld,optimize in stuf.utils.

How come the below does not work?

>>> from stuf.utils import ld,optimize; d=[{'A':1},{'A':1}]; ld(optimize(d))
[{'A': 1}, {'A': 1}]
>>> from stuf.utils import ld,optimize; d=[{'AA':1},{'A':1}]; ld(optimize(d))
[{'AA': 1}, {'A': 1}]
>>> from stuf.utils import ld,optimize; d=[{'AA':1},{'AA':1}]; ld(optimize(d))

Traceback (most recent call last):
  File "<pyshell#5>", line 1, in <module>
    from stuf.utils import ld,optimize; d=[{'AA':1},{'AA':1}]; ld(optimize(d))
BadPickleGet: 3
>>> 

Thx so much!


回答1:


It seems that the versions of shove and stuf that are installed with, for example, pip, are not compatible. I was able to download source from github and build both stuf and shove quickly on both OSX and Linux with 2.7.

git clone https://github.com/kwarterthieves/shove.git
git clone https://github.com/kwarterthieves/stuf.git

Resulted in these version numbers being installed:

stuf-0.8.13-py2.7.egg
shove-0.3.4-py2.7.egg

where pip installs:

shove-0.5.3-py2.7.egg-info
stuf-0.9.3-py2.7.egg-info

so I downgraded, but everything seems to be working okay now.



来源:https://stackoverflow.com/questions/11248577/shove-failing-because-of-pretty-basic-ld-vs-optimize-issue-in-stuf-util

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!