Python多处理池的ValueError无效的文字错误

时间:2015-12-08 17:59:19

标签: python scipy ipython anaconda python-multiprocessing

我有一个功能,我正在尝试并行运行。该函数的格式为

def parallelFunc(curUser):
    if curUser in neighbors.getUsers(): #neighbors is a global object of a class
        userData = createData.createData(inpMat1,inpMat2,inpMat3, neighbors.getNeighbors(curUser) )

    #inpMatX are numpy arrays/scipy sparse arrays/lists with global scope

        return userData # tried returning a double value too, get the same error

    else:
        return 0



pp = Pool(4) # tried with different values
ret = pp.map(parallelFunc, userList)

当我尝试运行此操作时,出现以下错误

ValueError: invalud literal for float(): 1.235443508738e

错误发生在multiprocessing / pool.pyc中。我在IPython笔记本中这样做。有关为什么会发生这种情况的任何想法?

堆栈追踪:

ValueError                                Traceback (most recent call last)
<ipython-input-99-2731048b72e2> in <module>()
      3 
      4 #st = time.time()
----> 5 ret = pp.map(parallelFunc, userList)
      6 #ft = time.time()
      7 

/opt/Anaconda/lib/python2.7/multiprocessing/pool.pyc in map(self, func, iterable, chunksize)
    249         '''
    250         assert self._state == RUN
--> 251         return self.map_async(func, iterable, chunksize).get()
    252 
    253     def imap(self, func, iterable, chunksize=1):

/opt/Anaconda/lib/python2.7/multiprocessing/pool.pyc in get(self, timeout)
    565             return self._value
    566         else:
--> 567             raise self._value
    568 
    569     def _set(self, i, obj):

ValueError: invalid literal for float(): 1.34716296703.978260894942e+06

0 个答案:

没有答案