使用Windows 10的python 2.7.13 / 14上的pathos cpickle错误

时间:2017-11-12 15:25:40

标签: python-2.7 windows-10 multiprocess dill pathos

基于示例multiprocess using pathos and dill,我遇到了cPickle错误。我按www3cam做了;稍加一点..通过删除病毒,莳萝,多进程和pyreadline。然后在仔细删除上面提到的那些侧包后点击pip install pathos --no-cache-dir。新的安装,PC的冷启动以及后来的Anacoda2更新...带有cPickles的罐子......仍然在那里,Frank Zappa继续唱着他的" Titties和Beer"曲。

来自1的修改后的代码:

#!/usr/bin/env python
# -*- coding: utf-8 -*-

import os, sys
import datetime, time
import multiprocessing
import pathos.pools as pp
import dill


class Multiprocess(object):

    def __init__(self):
        pass

    def qmp_worker(self,(inputs, the_time)):
        print " Processs %s\tWaiting %s seconds" % (inputs, the_time)
        time.sleep(int(the_time))
        print " Process %s\tDONE" % inputs

    def qmp_handler(self):                           # Non tandem pair processing
        pool = pp.ProcessPool(2)
        pool.map(self.qmp_worker, data)

def mp_worker((inputs, the_time)):
    print " Process %s\tWaiting %s seconds" % (inputs, the_time)
    time.sleep(int(the_time))
    print " Process %s\tDONE" % inputs
    sys.stdout.flush()

def mp_handler():                           # Non tandem pair processing
    p = multiprocessing.Pool(2)
    p.map(mp_worker, data)

def mp_handler_tandem():
    subdata = zip(data[0::2], data[1::2])
#    print subdata
    for task1, task2 in subdata:
        p = multiprocessing.Pool(2)
        p.map(mp_worker, (task1, task2))

#data = (['a', '1'], ['b', '2'], ['c', '3'], ['d', '4'])
data = (['a', '2'], ['b', '3'], ['c', '1'], ['d', '4'], 
        ['e', '1'], ['f', '2'], ['g', '3'], ['h', '4'])

if __name__ == '__main__':
    sys.stdout.flush()
#    print 'mp_handler():'
#    mp_handler()
#    print '---'
#    time.sleep(2)

#    print '\nmp_handler_tandem():'
#    mp_handler_tandem()
    print '---'
#    time.sleep(2)

    Multiprocess().qmp_handler()

也许应该像here"捕捉和打印PyQt5追溯一样设置一些东西?

下面的片段代码让我思考并好奇是否需要为莳萝做这样的事情?

# Back up the reference to the exceptionhook
sys._excepthook = sys.excepthook

# Set the exception hook to our wrapping function
sys.excepthook = my_exception_hook

最新错误:

  

文件" c:\ python \ anac2 \ lib \ site-packages \ pathos \ multiprocessing.py",第137行,在地图中      return _pool.map(star(f),zip(* args))#chunksize    文件" c:\ python \ anac2 \ lib \ site-packages \ multiprocess \ pool.py",第251行,在地图中      return self.map_async(func,iterable,chunksize).get()    文件" c:\ python \ anac2 \ lib \ site-packages \ multiprocess \ pool.py",第567行,获取      提高self._value   cPickle.PicklingError:无法发现:属性查找内置 .function失败

有关此错误的详细信息,请访问:my cPickle dump

0 个答案:

没有答案