問題描述
Windows 上的 Python 3.5,試試這些:
Python 3.5 on windows, try these:
拋出異常:
multiprocessing.Process 的子類拋出同樣的異常:
subclass of multiprocessing.Process throws the same exception:
推薦答案
這樣的東西應該可以工作:
Something like this should work:
基本上,一個 SSLContext
需要一個 protocol
,并且無論出于何種原因,protocol
都不會被保存(例如,它不在 >__reduce__
方法)當實例被腌制時.如果您需要更多狀態(即 __init__
方法中的其他 args
和 kwds
),那么您需要從上面的 save_sslcontext
函數.(注意,如果你在 python 2.x 中,那么適當的模塊是 copy_reg
).
Basically, a SSLContext
needs a protocol
, and for whatever reason, the protocol
is not saved (e.g. it's not in a __reduce__
method) when the instance is pickled. If you need more state (i.e. other args
and kwds
from the __init__
method), then you'll need to extend the return value from the save_sslcontext
function above. (Note, if you are in python 2.x, then the appropriate module is copy_reg
).
這篇關于如何腌制 ssl.SSLContext 對象的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!