Threading problem

Larry Whitley ldw at us.ibm.com
Wed Apr 3 10:52:07 EST 2002


I have a PC with two processors at work and have decided to try to use
threading to run some long running console applications.  My basic idea is
to start two threads, one for each processor, and give them a list of things
to do.  As each thread finishes it one job will go to the list and pick off
the next thing to do.  When the list is empty, both threads are done.

Here's a snippet of the code that inherits from threading.Thread:

class MyThread(threading.Thread):
    def __init__(self, thName, jobList, jobLock):
        threading.Thread().__init__(self, name=thName)
        self.jobList = jobList
        self.jobLock = jobLock


My code is failing in first statement of the constructor, you can see the
error below.


X:\Projects\Pecos\ttc6\thsp>run.py
Traceback (most recent call last):
  File "X:\Projects\Pecos\ttc6\thsp\run.py", line 59,
    main()
  File "X:\Projects\Pecos\ttc6\thsp\run.py", line 46,
    th1 = MyThread( "Thread1", jobList, jobLock )
  File "X:\Projects\Pecos\ttc6\thsp\run.py", line 9, i
    threading.Thread().__init__(self, name=thName)
  File "C:\Python22\lib\threading.py", line 355, in __
    assert group is None, "group argument must be None
AssertionError: group argument must be None for now

The thing that puzzles me is that threading.Thread() is insisting that
group=None.  That's ok with me, and I haven't changed it, yet it's
complaining as if I did.

What am I doing wrong?

Larry
Running Python 2.2





More information about the Python-list mailing list