<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Good day everyone!<br>
I would like my PEAK application to stop on ^C or SIGINT. Currently,
in that case I get an output something like<br>
<br>
> 29.09.2015 14:56:48.179 [DEBUG] Connect.twisted Unexpected
error in main loop.<br>
> 29.09.2015 14:56:48.190 [ERROR] Connect.twisted Traceback (most
recent call last):<br>
> 29.09.2015 14:56:48.190 [ERROR] File
"/Users/alexey/xtech2/tester/build/lib/ank/BBS/CommandBase.py", line
38, in run<br>
> 29.09.2015 14:56:48.190 [ERROR] self.mainLoop.run()<br>
> 29.09.2015 14:56:48.190 [ERROR] File
"/Library/Python/2.7/site-packages/peak/running/scheduler.py", line
78, in run<br>
> 29.09.2015 14:56:48.190 [ERROR] return
self.eventLoop.runUntil(self.exitCode,True,idle=self.sleep)[0]<br>
> 29.09.2015 14:56:48.190 [ERROR] File
"/Library/Python/2.7/site-packages/peak/events/twisted_support.py",
line 186, in runUntil<br>
> 29.09.2015 14:56:48.190 [ERROR] self.reactor.run(False)<br>
> 29.09.2015 14:56:48.190 [ERROR] File
"/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/twisted/internet/base.py",
line 1192, in run<br>
> 29.09.2015 14:56:48.190 [ERROR] self.mainLoop()<br>
> 29.09.2015 14:56:48.190 [ERROR] --- <exception caught
here> ---<br>
> 29.09.2015 14:56:48.190 [ERROR] File
"/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/twisted/internet/base.py",
line 1204, in mainLoop<br>
> 29.09.2015 14:56:48.190 [ERROR] self.doIteration(t)<br>
> 29.09.2015 14:56:48.190 [ERROR] File
"/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/twisted/internet/selectreactor.py",
line 105, in doSelect<br>
> 29.09.2015 14:56:48.190 [ERROR] [], timeout)<br>
> 29.09.2015 14:56:48.190 [ERROR] exceptions.KeyboardInterrupt:<br>
<br>
in the log file. In CommandBase.py attribute self.mainloop is
defined as <br>
<br>
> from peak.api import binding<br>
> from peak.running import commands, interfaces<br>
> class CommandBase(commands.EventDriven):<br>
> mainLoop = binding.Obtain(interfaces.IMainLoop)
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<br>
> ...<br>
<br>
If I set "peak.running.mainLoop.stopOnSignals" in my project's .ini
file to anything else except empty tuple, on the application's
startup I get the following error (I tried "stopOnSignals =
('SIGINT',)")<br>
<br>
> Traceback (most recent call last):<br>
> File "../ank/BBS/Assembler.py", line 370, in run<br>
> _exitCode = _root.run()<br>
> File
"/Library/Python/2.7/site-packages/peak/running/commands.py", line
229, in run<br>
> return self._run() or 0<br>
> File
"/Library/Python/2.7/site-packages/peak/running/commands.py", line
509, in _run<br>
> return self.invoke()<br>
> File
"/Users/alexey/xtech2/tester/build/lib/ank/BBS/CommandBase.py", line
38, in run<br>
> self.mainLoop.run()<br>
> File
"/Library/Python/2.7/site-packages/peak/running/scheduler.py", line
66, in run<br>
> handler = self.eventLoop.signals(*self.stopOnSignals)<br>
> File "_once.pyx", line 112, in _once.BaseDescriptor.__get__<br>
> File "_once.pyx", line 100, in _once.__get__<br>
> File
"/Library/Python/2.7/site-packages/peak/binding/components.py", line
682, in delegate<br>
> return getattr(getattr(s,delegateAttr),a)<br>
> File "_once.pyx", line 112, in _once.BaseDescriptor.__get__<br>
> File "_once.pyx", line 100, in _once.__get__<br>
> File
"/Library/Python/2.7/site-packages/peak/binding/components.py", line
682, in delegate<br>
> return getattr(getattr(s,delegateAttr),a)<br>
> File "_once.pyx", line 88, in _once.BaseDescriptor.__get__<br>
> AttributeError: ('Recursive attempt to compute attribute',
'signals')<br>
<br>
How do I do everything correctly?<br>
<br>
<br>
Best regards,<br>
Alexey Smishlayev<br>
</body>
</html>