函数递归时,递归次数到900多时,就是抛出异常exception RuntimeError('maximum recursion depth exceeded',)

import subprocess
import multiprocessing
import urllib
import sys
import os
import pymongo
import signal
import time
client=pymongo.MongoClient("192.168.139.143",27017)
db=client.domaindb
collection=db.domain

def getdomain(i):
        print("process id=%d,paren process id=%d,ppange=%d"%(os.getpid(),os.getppid(),i))
        time.sleep(1)
        getdomain(i+1)
if __name__ == '__main__': try: pool=multiprocessing.Pool(6) pool.map(getdomain,range(8)) #pool.map_async(getdomain,range(9)).get(10) pool.close() except KeyboardInterrupt: print 'get ctrl+c whild pool' pool.terminate() #except TimeoutException: except Exception ,e: print 'thrwo exception %r'%(e) finally: print 'joining complete' #pool.join() print 'join compele' print 'the end'

 

posted @ 2015-10-23 16:12  yixiong  阅读(815)  评论(0编辑  收藏  举报