msaenz 0 Light Poster

I have this program I wrote up and wanted to add signal handler to it. The thing is the example only show how to play with it but no to use in between methods. I tried coding it but it doesnt work

import sys
import signal
import operator
import stdpath
import datetime
from itertools import chain
from eventlet import api
from eventlet.db_pool import ConnectionPool as Connectlet
from ConfigParser import *
import sys
import time
from time import strftime


class Checker(self):
    def __init__(self):
              for route in config.options('MONITORS'):
            change_dict[route] = {}
            if config.get('MONITORS', destination) == 'false':
                settimes = [config.get('STARTTIME', destination), config.get('ENDTIME', destination)]
                change_dict[route]['times'] = settimes
            else:
                change_dict[route]['times'] = []
        for key, value in change_dict.iteritems():
             change_dict[key]['ch1'] = 0
             change_dict[key]['ch2'] = 0
             change_dict[key]['ch3'] = 0
             change_dict[key]['ech4'] = 0
             change_dict[key]['ch06'] = 0
             change_dict[key]['updatetime'] = 0
             change_dict[key]['routename'] = key
        api.spawn(self.refresh)
     
    def refresh(self):
        while True:
            self.publish(self.calling methodperiodically())
            api.sleep(25)    
    
    def handler(signum, frame):
        print 'Signal handler called with signal', signum
  
 
if __name__ == "__main__":
    checker = Checker()
    checker.listen()  
    while True:
        try:
          signum = int(sys.argv[1])
          signal.signal(signum, onSignal) 
            ev.sleep(10000)
        except:
            pass

Maybe I should try a smaller example of like a add or print method then try to kill the application? any suggestions? Thank you

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.