8000 threadpool - <type 'exceptions.AttributeError'>: 'NoneType' object has no attribute 'Empty' · Issue #1 · SpotlightKid/threadpool · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
threadpool - <type 'exceptions.AttributeError'>: 'NoneType' object has no attribute 'Empty' #1
Closed
@nixawk

Description

@nixawk

Threadpool is a nice python library. Today, we use it for multi tasks as follow:

def threads(threadnum, func, args_kwds, callback=None):
    """multi threads"""
    logger.debug("Threads: %d" % threadnum)

    def exp_callback(request, exc_info):
        pass

    requests = threadpool.makeRequests(func, args_kwds, callback, exp_callback)
    pool = threadpool.ThreadPool(threadnum)

    [pool.putRequest(req) for req in requests]

    while True:
        try:
            pool.poll()
        except KeyboardInterrupt:
            break
        except threadpool.NoResultsPending:
            break

    if pool.dismissedWorkers:
        pool.joinAllDismissedWorkers()

My main function code is:

args_kwds = [((i.strip(), ), {}) for i in open("ips.txt")]
threads(10, ip_task, args_kwds)

When tasks are finished, thread throws an exception.

Exception in thread Thread-5 (most likely raised during interpreter shutdown):
Traceback (most recent call last):
  File "/usr/lib/python2.7/threading.py", line 552, in __bootstrap_inner
  File "/opt/ip_task/threadpool.py", line 152, in run
<type 'exceptions.AttributeError'>: 'NoneType' object has no attribute 'Empty'
Exception in thread Thread-12 (most likely raised during interpreter shutdown):
Traceback (most recent call last):
  File "/usr/lib/python2.7/threading.py", line 552, in __bootstrap_inner
  File "/opt/ip_task/threadpool.py", line 152, in run

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0