I'm a novice at Python, and found some code samples on how to use threads. My script is being run by a product that contains a Jython interpreter. Can someone please explain why I get the following error:
Traceback (innermost last): File "/full/path/to/file/GenerateData.py", line 104, in ? File "/full/path/to/file/GenerateData.py", line 34, in __init__ TypeError: unbound method must be called with class instance 1st argument Here are the important pieces of my GenerateData.py script. Note that "scriptinterface" is something provided by the product to allow my script to interface with it. Line 104 is the last line -- the one that creates a GenThread and calls start() on it. import sys # need this section otherwise the import random won't work if sys.path.count('/usr/local/lib/python2.2/') == 0: sys.path.append('/usr/local/lib/python2.2/') import random import time import threading from java.lang import String from jarray import array class GenThread(threading.Thread): def __init__(self, ipAddress, port): threading.Thread.__init__() self.ipAddress = ipAddress self.port = str(port) def run(self): # # code # GenThread(scriptinterface.getSnmpIPAddress(), scriptinterface.getSnmpPort()).start() -- http://mail.python.org/mailman/listinfo/python-list