[Mailman-Developers] error message from cron

Ken Manheimer klm@python.org
Mon, 11 Jan 1999 11:57:32 -0500 (EST)


On Mon, 11 Jan 1999, Balazs Nagy wrote:

> On Sun, 10 Jan 1999, Gergely Madarasz wrote:
> > [...]
> > os.error: (2, 'No such file or directory')
> 
> Fast fix:
> 
> --- OutgoingQueue.py.orig	Mon Jan 11 09:40:30 1999
> +++ OutgoingQueue.py	Mon Jan 11 09:40:50 1999
> @@ -176,4 +176,7 @@
>  # remove it from the queue 
>  #
>  def dequeueMessage(q_entry):
> -    os.unlink(q_entry)
> +    try:
> +	os.unlink(q_entry)
> +    except:
> +	pass

(Thanks for the suggestion!  Due to some overriding other concerns i
won't have time immediately to look at incorporating it - maybe one of
the other central folks will - but i do have a fairly important coding
practice to suggest for mailman submissions. 

Avoid using unqualified 'excepts' unless the exception case code does
something specific with the results.  Ie, prevent hiding unanticipated
exceptions, just catch the ones you mean to catch.  In this case,
something like 'except os.error' instead of 'except'.  

And that's just for the fast fix - a real fix should take check that the
os.error is "no such file...", and perhaps log something...  We're
urgently trying to eliminate anything that hides bugs, otherwise the
system's operation becomes full of mysteries, and not approachable as an
open source effort.  (Hidden bugs are nuisances in *any* context.)

Please don't take this as a criticism of your input - i'm just taking
the opportunity to make this practice clear to everyone.)

ken manheimer
klm@python.org