#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


Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks