[issue11792] asyncore module print to stdout

2011-04-07 Thread Samuele Kaplun

New submission from Samuele Kaplun samuele.kap...@cern.ch:

The method log_info of the dispatcher class of the asyncore.py module, uses 
print statement to print to stdout.

This lead to conflicts when asyncore is used within e.g. mod_wsgi, as writing 
to stdout is not supposed to be valid.

--
components: Library (Lib)
messages: 133198
nosy: kaplun
priority: normal
severity: normal
status: open
title: asyncore module print to stdout
type: behavior
versions: Python 2.5, Python 2.6, Python 2.7, Python 3.1

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11792
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11792] asyncore module print to stdout

2011-04-07 Thread Samuele Kaplun

Samuele Kaplun samuele.kap...@cern.ch added the comment:

Thanks for looking into it.

Indeed that's the workaround I implemented in our application. On the other 
hand it would be nice if either:

* the log_info method would print to stderr,
* would use warning.warn()
* would use the logging module to allow for fine grained configuration

The 1st solution would be already enough for mod_wsgi usage (also see: 
http://code.google.com/p/modwsgi/wiki/ApplicationIssues#Writing_To_Standard_Output)

Cheers!

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11792
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11792] asyncore module print to stdout

2011-04-07 Thread Samuele Kaplun

Samuele Kaplun samuele.kap...@cern.ch added the comment:

Hi Giampaolo,

shouldn't then the 2nd option I was proposing (i.e. to call warning.warn) the 
best behavior, given your explanation?

[...]
Warning messages are typically issued in situations where it is useful to alert 
the user of some condition in a program, where that condition (normally) 
doesn’t warrant raising an exception and terminating the program. For example, 
one might want to issue a warning when a program uses an obsolete module.

Python programmers issue warnings by calling the warn() function defined in 
this module. (C programmers use PyErr_WarnEx(); see Exception Handling for 
details).
[...]

In this case asyncore might want raise a warning, since the client code of 
asyncore was expected to handle the event.

If the semantic of log_info is to basically alert the developer is there any 
particular benefit in printing directly to stdout rather than raising a warning 
(or simply printing to stderr)?

Ciao!

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11792
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com