PEP-0263 and default encoding
Alex Martelli
aleax at aleax.it
Wed Oct 1 09:46:33 EDT 2003
Klaus Alexander Seistrup wrote:
...
>> Just silence the warning in site.py.
>
> Where and how in site.py can I do that?
Module warnings is well worth studying. You can insert (just about
anywhere you prefer in your site.py or site-customize py) the lines:
import warnings
warnings.filterwarnings('ignore', 'Non-ASCII character .*/peps/pep-0263',
DeprecationWarning)
this tells Python to ignore all warning messages of class DeprecationWarning
which match (case-insensitively) the regular expression given as the second
parameter of warnings.filterwarnings (choose the RE you prefer, of course --
here, I'm asking that the warning message to be ignored start with
"Non-ASCII character " and contain "/peps/pep-0263" anywhere afterwards,
but you may easily choose to be either more or less permissive than this).
Alex
More information about the Python-list
mailing list