passing no arguments to a callback function question
matthew
matthew at newsgroups.com
Tue Apr 8 02:38:23 EDT 2003
Hi,
I'm pretty new to python and most of my stumblings get me somewhere but
I'm stumped on this. Given the following code/exception how do I avoid
the exception generated when notify_listeners is called?
def __init__(self, file_to_process):
NC_Scanner.__init__(self, file_to_process, self.lexicon,
self.event_types)
self.add_listener('any', print_event, 'any')
self.add_listener('position', print_params, args=None)
def event_end(self, scanner):
self.notify_listeners('any')
self.notify_listeners(self.state_name) # initiates callbacks
for the particular event scanned in Plex
self.begin('')
def print_params():
print 'PARAMS: ', params
gives:-
File "D:\Python22\Lib\site-packages\TeePee\notifier.py", line 39, in
__call__
return self.fn(*(self.args + args), **d)
TypeError: print_params() takes no arguments (1 given)
I hope this isn't too garbled. Thanks for the help. matthew.
More information about the Python-list
mailing list