Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#11 events block for run should support self method functions

open
nobody
None
5
2007-01-10
2007-01-10
Anonymous
No

You see an error like this when an appropriate match occurs if the events map contains self.method calls.

runout=pexpect.run('cat vpnout',timeout=1,events=events,extra_args=self)
File "/usr/lib/python2.4/site-packages/pexpect.py", line 215, in run
raise TypeError ('The callback must be a string or function type.')

The fix is easy:

Change line 207 of pexpect.py to the following:

elif type(responses[index]) is types.FunctionType or type(responses[index]) is types.MethodType:

(basically, add in a check for MethodType as well.

Thanks,
Christian

cpw@weeksfamily.ca

Discussion