Python Interview Questions

Roy Smith roy at
Mon Nov 19 15:30:54 CET 2012

In article <50a9e5cf$0$21863$c3e8da3$76491128 at>,
 Steven D'Aprano <steve+comp.lang.python at> wrote:

> I see. It wasn't clear from your earlier description that the items had 
> been post-processed from collections of raw log lines to fixed records.

Well, I did provide the code that does this.
> But it doesn't actually change my analysis any. See below.
> By the way, based on the sample data you show, your script is possibly 
> broken. You don't record either the line number that raises, or the 
> exception raised, so your script doesn't differentiate between different 
> errors that happen to occur with similar stack traces. 

You really might want to read the code I provided.  Here's the reference 

The "header" referred to does indeed contain the exception raised.  And 
the line numbers are included.  Here's a typical output stanza:

2012-11-19T00:00:15+00:00 web5 ˇ˛2012-11-19 00:00:15,831 [2712]: 
songza-api IGPhwNU2SJ691cx8 4C0ABFA9-50A974E7-384995 W6D-HSO songza.django.middleware ERROR process_exception() Path = 
u'/api/1/station/1459775/next', Exception = 
ValueError(u"<SequentialSongPicker: <Station 1459775: u'Old School 
105.3'>>: no song ids for mp3",)

> I say "possibly" broken because I don't know what your requirements are.

Our requirements are to scan the logs of a production site and filter 
down the gobs and gobs of output (we produced 70 GB of log files 
yesterday) into something small enough that a human can see what the 
most common failures were.  The tool I wrote does that.

The rest of this conversation is just silly.  It's turning into getting 
hit on the head lessons.

More information about the Python-list mailing list