Contributors mailing list archives


Re: Escape python lint

Vauxoo, Moisés López Calderón
- 23/10/2019 21:44:42
I have created the following script in a file:

import logging

_logger = logging.getLogger(__name__)

query = """SELECT
'Hello World'"""
_logger.warn("Query error %s",

So, I called it using the following command:
`~/odoo-12.0/odoo-bin shell -d openerp_test --log-level=warn <`

The output was:
Screen Shot 2019-10-23 at 14.40.31.png

Since that python3 is using bytes by default it is printed using bytes (Notice the "\n" instead of a real newline).

Using `print` the output is ignored for `--log-file=out.txt` parameter or a odoo started using a service.
So it is better using a logger.

But if you like skip this pylint check you can use a comment:
`# pylint: disable=print-used`

More info about:

El mié., 23 oct. 2019 a las 12:57, David Beal (<>) escribió:
Thanks Pedro.

For my information about ways to escape python lint.
- no way
- documented somewhere or example


David BEAL

Le mer. 23 oct. 2019 à 19:12, Pedro M. Baeza (Tecnativa) <> a écrit :
Answered in the PR as well: Why not emit it as logger.warning or similar?

Post to:

Post to:

Moisés López Calderón
Mobile: (+521) 477-752-22-30
Twitter: @moylop260
hangout: - Odoo Gold Partner
Twitter: @vauxoo