Python ThreadPool进程挂起

时间:2018-02-09 17:51:19

标签: python threadpool hang

import sys
import os
import urllib3
urllib3.disable_warnings()
from multiprocessing.pool import ThreadPool
import importlib
from time import gmtime, strftime
import shutil



def check(USERINFO):
    try:
        DO SOMETHING
    except:
        pass
    else:
        try:
            DO SOMETHING
        except:
            pass
        else:
            DO SOMETHING

if __name__ == '__main__':
    file = sys.argv[1]
    p = ThreadPool(processes=int(sys.argv[2]),)
    combos = []
    for x in list(set(open(file, 'r').readlines())):
        combos.append(x)
    p.map(check, combos)
    p.close() 
    p.join() 

我有这样的应用程序,简单但有时会因为"挂起而导致卡住了#34; process.This是太简单的脚本没有办法在任何地方使用错误句柄得到任何错误,idk什么问题,但几乎尝试了一切。

编辑:python版本2.7.14

0 个答案:

没有答案