threads module question

Daley, Mark W mark.w.daley at intel.com
Tue Aug 22 18:11:01 EDT 2000


I don't understand what the threads module is telling me when it says 'first
arg must be callable'.  Can anyone direct me on the correct syntax for using
this module?  Here is my feeble attempt:

import thread

main = Main()
thread.start_new_thread(main.showvalues(), <What goes here?>)

class Main:
	def __init__(self):
		t.insert(END, 'Thread started...')
		if os.path.exists(alternate):
			os.remove(alternate)
		self.prewrite = 0
		self.z = 0

	def showvalues(self):
		<process here>

Here's the traceback:

Exception in Tkinter callback
Traceback (innermost last):
  File "C:\Program Files\Python\Lib\lib-tk\Tkinter.py", line 764, in
__call__
    return apply(self.func, args)
  File "C:\Python\gui.py", line 47, in interact
    thread.start_new_thread(main, 'self')
TypeError: first arg must be callable


Please bear in mind that my class writing skills rank only slightly above my
ability to use threads.  I am still learning these concepts.

- Mark
----------------------------------------------
The opinions expressed are mine, and are not necessarily those of my
employer.






More information about the Python-list mailing list