[PEAK] problem with peak.io_events

Vladimir Iliev vlado at vintech.bg
Mon Sep 13 04:04:54 EDT 2004


Phillip J. Eby wrote:

> Please define "doesn't work".

The callback is not called.

>
> I would think, from the original source, that you would get error 
> messages on the console, if 'count' were not imported.

Try running the attached script with and without 'import itertools' and 
see what happens when you press ctrl+c for example.

I know, it sounds silly, the itertools import should not affect app's 
behavior but it just does.


-------------- next part --------------
from peak.api import *
from peak.running.commands import EventDriven
from peak.running.daemons import AdaptiveTask
from peak.events.io_events import signals, signal_names
from peak.running.interfaces import ITaskQueue
from peak.events.interfaces import ISignalSource

import itertools

class MyTask(AdaptiveTask):

    def getWork(self):
        pass

    def doWork(self, job):
        pass

class Comp(binding.Component):

    def _setup(self):
        def cb(*a): print 'bzzzzzzzzzzzzz'
        ss = self.lookupComponent(ISignalSource)
        ss.signals(*tuple(signals)).addCallback(cb)
	MyTask(self, runEvery=1)
    _setup = binding.Make(_setup, uponAssembly=True)

class MyApp(EventDriven):
    commands = binding.Make(Comp, uponAssembly=True)

if __name__ == '__main__':
    MyApp(config.makeRoot()).run()



More information about the PEAK mailing list