How to display PendingDeprecationWarning using dev. server?

149 views
Skip to first unread message

Brian Neal

unread,
Feb 28, 2010, 6:28:02 PM2/28/10
to Django users
I'm having trouble seeing PendingDeprecationWarning's on stderr when
using the dev server.

To make sure I'm not crazy, I wrote a simple Python program that looks
like this:

print "************** WARNING **********************"
import warnings
warnings.warn(
"Testing the warnings module!",
PendingDeprecationWarning
)

And here are some sample runs:

$ python warning.py
************** WARNING **********************
$ python -Wall warning.py
************** WARNING **********************
warning.py:5: PendingDeprecationWarning: Testing the warnings module!
PendingDeprecationWarning

Now when I put that code in some view function in my Django app, I
always see the print statement output, but never the actual warning
message. I've tried starting the dev. server various ways, but none of
them seem to work:

$python -Wall manage.py runserver
$python -Wd manage.py runserver

I only seem to have this trouble with PendingDeprecationWarning.
UserWarning, for example, works as expected.

What am I doing wrong? I am using Python 2.5.2 and Django SVN r12623.
Thanks.

Brian Neal

unread,
Mar 5, 2010, 9:28:14 PM3/5/10
to Django users
Any ideas? Can anyone else try this and report back? Just insert the
code below into a view function and start the dev. server with "python
-Wall manage.py runserver". Thanks.

pjrh...@gmail.com

unread,
Mar 6, 2010, 10:41:56 AM3/6/10
to Django users
On Mar 6, 2:28 am, Brian Neal <bgn...@gmail.com> wrote:
> Any ideas? Can anyone else try this and report back? Just insert the
> code below into a view function and start the dev. server with "python
> -Wall manage.py runserver". Thanks.

Hi,

Just to confirm I tried it and can't see them either, on python 2.6.
Don't know enough about them to shed any light on the subject, but it
isn't just you!

Peter

Karen Tracey

unread,
Mar 6, 2010, 11:29:30 AM3/6/10
to django...@googlegroups.com
On Fri, Mar 5, 2010 at 9:28 PM, Brian Neal <bgn...@gmail.com> wrote:
Any ideas? Can anyone else try this and report back? Just insert the
code below into a view function and start the dev. server with "python
-Wall manage.py runserver". Thanks.

This appears to be due to the way runserver reloads the process when monitoring for source code changes.  If you specify --noreload on runserver I bet you will see the warnings. The behavior appears to be OS-specific: I can recreate what you describe on Ubuntu, but on Windows machine the warnings are printing properly.

Karen

 
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django...@googlegroups.com.
To unsubscribe from this group, send email to django-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.


Brian Neal

unread,
Mar 6, 2010, 11:53:00 AM3/6/10
to Django users
On Mar 6, 10:29 am, Karen Tracey <kmtra...@gmail.com> wrote:
> This appears to be due to the way runserver reloads the process when
> monitoring for source code changes.  If you specify --noreload on runserver
> I bet you will see the warnings. The behavior appears to be OS-specific: I
> can recreate what you describe on Ubuntu, but on Windows machine the
> warnings are printing properly.
>
> Karen
>
Thanks Karen. Yes, I'm using Ubuntu, and running with --noreload
allows me to see the PendingDeprecationWarning. Is this worthy of a
bug report?

Regards,
BN

Karen Tracey

unread,
Mar 6, 2010, 12:17:13 PM3/6/10
to django...@googlegroups.com
On Sat, Mar 6, 2010 at 11:53 AM, Brian Neal <bgn...@gmail.com> wrote:
Thanks Karen. Yes, I'm using Ubuntu, and running with --noreload
allows me to see the PendingDeprecationWarning. Is this worthy of a
bug report?

Sure. Just please don't put it in the 1.2 milestone; it's not a release blocker.

Karen
Reply all
Reply to author
Forward
0 new messages