Apparently when my signal handler exits, my program CONTINUE TO RUN. this is evident by the exception raised even AFTER the "log Done, close now". Can someone explain why this is so? Note the functions have been simplified
^Clog Ctrl-C
backup State: not_span 328, pos 22, all_cycles 19
backup backup complete, you may force exit now
log Done, close now
Traceback (most recent call last):
File "singleEdger.py", line 219, in <module>
mySingleEdger.outputAllCycles()
File "singleEdger.py", line 141, in outputAllCycles
r = self.returnCycle( self.dfs_tree, self.not_span[self.pos])
File "singleEdger.py", line 72, in returnCycle
udfs = nx.Graph(dfs) # The trick is to make it undirected
File "/var/lib/python-support/python2.6/networkx/graph.py", line 86, in __init__
convert.from_whatever(data,create_using=self)
File "/var/lib/python-support/python2.6/networkx/convert.py", line 76, in from_whatever
"Input is not a correct NetworkX graph."
networkx.exception.NetworkXError: Input is not a correct NetworkX graph.
These are the functions for reference
def sigHandler(self, arg1, arg2):
out('log', 'Ctrl-C')
self.backup()
out('log', 'Done, close now')
exit()
def outputAllCycles(self):
while self.pos < len(self.not_span):
r = self.returnCycle( self.dfs_tree, self.not_span[self.pos])
if r:
self.all_cycles.append( r )
for each in r: # now it's [ (3,4), (5,6) ]
each = (sellHash(each[0]), sellHash( each[1]) )
self.outfo.write( each[0] +'\t'+ each[1] )
self.outfo.write( '\n')
self.outfo.write( '\n')
self.pos += 1
out( "singleEdger", "outputAllCycles done")
def backup(self):
out( 'backup', 'State: not_span %i, pos %i, all_cycles %i' % ( len(self.not_span), self.pos, len(self.all_cycles)) )
out( 'backup', 'backup complete, you may force exit now')