[Tutor] Re: Catching warnings?

Liam Clarke cyresse at gmail.com
Wed Oct 20 05:00:24 CEST 2004


I'm only using rotor because I couldn't get the a2b_uu functions to work : ) 
I just need to render something into not-plaintext. It's not hugely
important, all the email passwords are defaults anyway....

And Bill - 

try:

   import rotor

except:
     pass

which is now replaced with - 

from warnings import *
filterwarnings('ignore',"", DeprecationWarning, "", 0)

But yes, any suggestions on what to replace rotor with would be appreciated.

Regards,

Liam Clarke

On Tue, 19 Oct 2004 18:20:30 -0700 (PDT), Danny Yoo
<dyoo at hkn.eecs.berkeley.edu> wrote:
> 
> 
> On Tue, 19 Oct 2004, Bill Mill wrote:
> 
> > The 'rotor' module is deprecated:
> >
> > >>> import rotor
> > __main__:1: DeprecationWarning: the rotor module uses an insecure algorithm and
> > is deprecated
> >
> > If we want to ignore the error, we can simply catch it as we do any
> > other exception:
> >
> > >>> try:
> > ...     import rotor
> > ... except DeprecationWarning:
> > ...     pass
> > ...
> > >>>
> 
> 
> As a warning, when something's labeled as "deprecated" in Python, the
> implementors really mean it: 'rotor' is gone in the upcoming Python 2.4
> release.
> 
> So, unless there's an overriding reason, don't ignore DeprecationWarnings,
> because there is a strong chance that code that uses a deprecated feature
> won't work in the future.  Warnings are there for a reason!  *grin*
> 
>


More information about the Tutor mailing list