[Python-ideas] Displaying DeprecationWarnings in the interactive interpreter, second try

Jonathan Slenders jonathan at slenders.be
Thu May 28 10:53:13 CEST 2015


+1 on this too.

I'm author of the "ptpython" REPL.

Nathaniel Smith: could you tell me what I should do?

Is it enough when I make sure that all code runs in __main__ and running
this command at the start?
warnings.filterwarnings("default", category=DeprecationWarning,
module="__main__")

Jonathan




2015-05-28 10:26 GMT+02:00 M.-A. Lemburg <mal at egenix.com>:

> On 28.05.2015 02:29, Nathaniel Smith wrote:
> > Hi all,
> >
> > I'm tired of getting bug reports like this one:
> >
> >   https://github.com/numpy/numpy/issues/5919
>
> Well, in that particular case, I think numpy should raise a TypeError
> instead of a DeprecationWarning :-)
>
> > where the issue is just that the user didn't see deprecation warnings,
> > so I just filed a bug report requesting that the interactive Python
> > REPL start printing DeprecationWarnings when users use deprecated
> > functionality:
> >
> >   https://bugs.python.org/issue24294
>
> +1 on the general idea, but I think this needs some more thought
> on the topic of how you detect an interactive session that's being
> used by a user.
>
> You wouldn't want these warning to show up when piping in commands
> to a Python interpreter.
>
> In eGenix PyRun we use sys.stdin.isatty() to check whether we
> want an interactive prompt or not. I guess the same could be done
> here.
>
> --
> Marc-Andre Lemburg
> eGenix.com
>
> Professional Python Services directly from the Source  (#1, May 28 2015)
> >>> Python Projects, Coaching and Consulting ...  http://www.egenix.com/
> >>> mxODBC Plone/Zope Database Adapter ...       http://zope.egenix.com/
> >>> mxODBC, mxDateTime, mxTextTools ...        http://python.egenix.com/
> ________________________________________________________________________
>
> ::::: Try our mxODBC.Connect Python Database Interface for free ! ::::::
>
>    eGenix.com Software, Skills and Services GmbH  Pastor-Loeh-Str.48
>     D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
>            Registered at Amtsgericht Duesseldorf: HRB 46611
>                http://www.egenix.com/company/contact/
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20150528/55014d7d/attachment.html>


More information about the Python-ideas mailing list