TypeError:无法序列化套接字对象

时间:2020-06-22 17:29:43

标签: python-3.x sockets

我正在尝试遵循以下基于examplenordnet API.

在linux(Ubuntu)上,示例运行良好,但是当我在Windows计算机上尝试相同的操作时,出现以下错误。请注意,我已经从jupyter笔记本而不是CMD复制并粘贴了错误,因为我更喜欢jupyter中的回溯。

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-13-263240bbee7e> in <module>
----> 1 main()

<ipython-input-12-6bdb6840d154> in main()
     35     # Start a parallel process that keeps receiving updates from the TCP socket
     36     proc = Process(target=receive_message_from_socket, args=(feed_socket,))
---> 37     proc.start()
     38 
     39     # Login to public feed with our session_key from NEXT API response

c:\program files\python36\lib\multiprocessing\process.py in start(self)
    103                'daemonic processes are not allowed to have children'
    104         _cleanup()
--> 105         self._popen = self._Popen(self)
    106         self._sentinel = self._popen.sentinel
    107         # Avoid a refcycle if the target function holds an indirect

c:\program files\python36\lib\multiprocessing\context.py in _Popen(process_obj)
    221     @staticmethod
    222     def _Popen(process_obj):
--> 223         return _default_context.get_context().Process._Popen(process_obj)
    224 
    225 class DefaultContext(BaseContext):

c:\program files\python36\lib\multiprocessing\context.py in _Popen(process_obj)
    320         def _Popen(process_obj):
    321             from .popen_spawn_win32 import Popen
--> 322             return Popen(process_obj)
    323 
    324     class SpawnContext(BaseContext):

c:\program files\python36\lib\multiprocessing\popen_spawn_win32.py in __init__(self, process_obj)
     63             try:
     64                 reduction.dump(prep_data, to_child)
---> 65                 reduction.dump(process_obj, to_child)
     66             finally:
     67                 set_spawning_popen(None)

c:\program files\python36\lib\multiprocessing\reduction.py in dump(obj, file, protocol)
     58 def dump(obj, file, protocol=None):
     59     '''Replacement for pickle.dump() using ForkingPickler.'''
---> 60     ForkingPickler(file, protocol).dump(obj)
     61 
     62 #

c:\program files\python36\lib\socket.py in __getstate__(self)
    183 
    184     def __getstate__(self):
--> 185         raise TypeError("Cannot serialize socket object")
    186 
    187     def dup(self):

TypeError: Cannot serialize socket object

0 个答案:

没有答案