Project

General

Profile

« Previous | Next » 

Revision 985

exc.py: Generalize ExTracker to not just print the # of errors at exit. Instead, provide an exit() method that the ExTracker creator can call at exit to set the exit status to the # of errors. This fixes the Python bug where a benign error message was printed if SystemExit was raised in an atexit function.

View differences:

map
200 200
    
201 201
    ex_tracker = exc.ExPercentTracker(iter_text='row')
202 202
    profiler = profiling.ItersProfiler(start_now=True, iter_text='row')
203
    
203 204
    doc = xml_dom.create_doc()
204 205
    root = doc.documentElement
205 206
    if out_is_db:
......
244 245
            doc.writexml(sys.stdout, **xml_dom.prettyxml_config)
245 246
        else: # output is CSV
246 247
            raise NotImplementedError('CSV output not supported yet')
248
    
247 249
    profiler.stop(row_ct)
248 250
    ex_tracker.add_iters(row_ct)
249 251
    sys.stderr.write('Processed '+str(row_ct)+' input rows\n')
250 252
    sys.stderr.write(profiler.msg()+'\n')
253
    sys.stderr.write(ex_tracker.msg()+'\n')
254
    ex_tracker.exit()
251 255

  
252 256
def main():
253 257
    try: main_()

Also available in: Unified diff