Hi,

I am trying to call an unbound method (PrintInput) with the object
instance as the first argument but getting the following error:
"TypeError: unbound method PrintInput() must be called with test
instance as first argument (got test instance instead)"

Below is the sample code (test) for this purpose (two files).

Any help is greatly appreciated.

Thanks in Advance, Anat


Sample Code:

File 1 - input_file.py:

#!/usr/bin/env python
from test import *

CMD = (test.PrintInput, float(2))

File 2 - test.py:

from input_file import *

class test:
    def __init__(self):
        _test = 2
    def PrintInput(self, input):
        print "Input is = %s"%(input)

if __name__== "__main__":
    print "Unit testing"
    inst = test()
    print CMD
    cmd = CMD[0]
    param = CMD[1:]
    
    cmd(inst,param)        # this is the problematic line

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to