我需要在基于GAE Python的应用程序中将Socket对象存储到datastore / memcache中。
我采取的方法是
1.使用pickle.dumps将套接字对象转换为字符串
2.需要时,使用pickle.loads(<pickledSock>)
下面是完整的错误消息,但主要部分是:
TypeError: __init__() got an unexpected keyword argument '_sock'
这是否意味着我无法使用上述方法,因为&#34; unpickling&#34;不会工作吗?
ssl_sock2Use=pickle.loads(pickledSock)
File "/base/data/home/runtimes/python27/python27_dist/lib/python2.7/pickle.py", line 1382, in loads
return Unpickler(file).load()
File "/base/data/home/runtimes/python27/python27_dist/lib/python2.7/pickle.py", line 858, in load
dispatch[key](self)
File "/base/data/home/runtimes/python27/python27_dist/lib/python2.7/pickle.py", line 1217, in load_build
setstate(state)
File "/base/data/home/runtimes/python27/python27_dist/lib/python2.7/socket.py", line 181, in __setstate__
self.__init__(_sock=_sock)
TypeError: __init__() got an unexpected keyword argument '_sock'