Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

"Thank heaven for startups; without them we'd never have any advances." -- Seymour Cray


devel / comp.lang.python / Re: What should go to stdout/stderr and why Python logging write everything to stderr?

SubjectAuthor
o Re: What should go to stdout/stderr and why Python logging writeWeatherby,Gerard

1
Re: What should go to stdout/stderr and why Python logging write everything to stderr?

<mailman.1379.1672775549.20444.python-list@python.org>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=25384&group=comp.lang.python#25384

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!news.szaf.org!fu-berlin.de!uni-berlin.de!not-for-mail
From: gweatherby@uchc.edu (Weatherby,Gerard)
Newsgroups: comp.lang.python
Subject: Re: What should go to stdout/stderr and why Python logging write
everything to stderr?
Date: Tue, 3 Jan 2023 19:52:07 +0000
Lines: 42
Message-ID: <mailman.1379.1672775549.20444.python-list@python.org>
References: <4NmcJ022hFz6tpm@submission01.posteo.de>
<CACL+1asMm6Lo8rh7avK8sLTTo69r69mgyMi=nKnHArwsHOr4Lw@mail.gmail.com>
<SJ0PR14MB5864C922F2299A8391140D36B9F49@SJ0PR14MB5864.namprd14.prod.outlook.com>
Mime-Version: 1.0
Content-Type: text/plain; charset="Windows-1252"
Content-Transfer-Encoding: quoted-printable
X-Trace: news.uni-berlin.de bhRDEmhY0MfJ2b1G0YznDw4U111y155RZzeM+GEILTww==
Return-Path: <prvs=0367db1319=gweatherby@uchc.edu>
X-Original-To: python-list@python.org
Delivered-To: python-list@mail.python.org
Authentication-Results: mail.python.org; dkim=pass
reason="2048-bit key; unprotected key"
header.d=uchc.edu header.i=@uchc.edu header.b=mH9GpDMr;
dkim-adsp=pass; dkim-atps=neutral
X-Spam-Status: OK 0.019
X-Spam-Evidence: '*H*': 0.96; '*S*': 0.00; 'usage': 0.05; '2023':
0.07; 'debug': 0.07; 'cc:addr:python-list': 0.09;
'received:namprd14.prod.outlook.com': 0.09; 'typically': 0.09;
'subject:Python': 0.12; '&gt;': 0.14; 'import': 0.15;
'url:mailman': 0.15; '***': 0.16; 'eryk': 0.16; 'python3': 0.16;
'stdout': 0.16; 'stdout.': 0.16; 'subject:logging': 0.16;
'url:urldefense': 0.16; 'url:v3': 0.16; 'writes': 0.16; 'wrote:':
0.16; 'python': 0.16; 'cc:addr:python.org': 0.20; 'written': 0.22;
'skip:p 30': 0.23; 'url:listinfo': 0.25; 'cc:2**0': 0.25;
'header:Received:9': 0.26; 'opening': 0.26; 'received:edu': 0.26;
"isn't": 0.27; 'output': 0.28; 'email addr:python.org&gt;': 0.28;
'goes': 0.28; 'error': 0.29; 'python-list': 0.32; 'script': 0.33;
'header:In-Reply-To:1': 0.34; 'particularly': 0.35; 'request':
0.35; 'received:filterd': 0.37; 'received:pps.filterd': 0.37;
'url-ip:13.107/16': 0.38; 'file': 0.38; 'date:': 0.39; 'use':
0.39; 'seconds': 0.40; 'subject:What': 0.40; 'should': 0.40;
'charset:windows-1252': 0.60; 'email.': 0.61; 'from:': 0.62;
'to:': 0.62; 'everything': 0.63; 're:': 0.64; 'skip:! 10': 0.67;
'url-ip:104.18/16': 0.67; 'cc:': 0.69; 'manually': 0.69; 'url-
ip:52.6/16': 0.69; 'skip:f 30': 0.71; 'january': 0.71; 'clicking':
0.76; 'links.': 0.81; 'attention:': 0.84; 'email name:&lt;python-
list': 0.84; 'skip:& 50': 0.84; 'subject: \n ': 0.84
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=uchc.edu;
h=from : to : cc :
subject : date : message-id : references : in-reply-to : content-type :
mime-version; s=UCHC03162020;
bh=jzAdo/6FVbenEX9KcaxIP40SI7ibLEFAgQx+2k+LFfE=;
b=mH9GpDMrf0jW5KyjMqUxzLW11fhsTLlIv/rgbStLSfr2Js2CB0jvmPICxWTjlsSMxwwj
AgyXOEYyDfcgCGl94+O3XrddJxDOwAgKtmhEktpn3NUNnpIuPC2zvJt5nH7UE85Pu1ih
hBrguTKC6Vyox0Cnzge0WLJK06I7nq1Mo3uB+gLb+VWqoKgPWw562WMzOYkzKgmzGnM7
qmm1z7rsIsqP6KltNH21WEIBmxSRg1hkNetOVWNMLP0CI7+jAXBKpPXw7/zusz6FDBOC
eRC1ckzIVqar4wXNCjPYGk03mc9XxR70hPKuFc13vSG3hCcp8KQUkfzuTaUQlwV8qNOx zw==
ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none;
b=Fvoyrl939xHDe7JLL3pU2RDnCrHmHPr5oVGN4IoE2UsMuC24zHRW5uaJnqP7xByx8biJfzR5vfcJOxPvsQd1caO+IJ9e3QytcjFOHVIulwTc33uyv2VZGu0s/YKabDic2Yy9Rv57ZnFrXMyRPjawDsQO3NZqyfJY5HaG4JXVlOlgaMtxFoZXeOUO3bXGZ1xp11IDJmVKFCiko8PZhnN54qSnuWj3tA60D6zRfpaFSdFKWku8rWIiOQo7RTNqZAC/VwF3Hf6AiygJ82GXMdRD1A7njmcHbc/dHlJqRQhLgrRAzTIZ5fTvyE9zDrhrVLVEl92oFWNj42mPgVDltrQkAA==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com;
s=arcselector9901;
h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1;
bh=jzAdo/6FVbenEX9KcaxIP40SI7ibLEFAgQx+2k+LFfE=;
b=i7jGS6w211+H1hICmxZj4qw7OpTJdzwA5ndTI4M9sI1fkDzJnpkDs4dS2D2rJM6/KiQll/2yTmCUhrJEMEDVNDaBk//2kzxdsyZxAlibevCw6XN2EVjAS4hsLCRY7enu67Cy20WrwmnokwLUrQ585P5TsCGQQSlzh1BUkZdc0iw67iGlZCHkC+ecCNA0UBaFHY5v5czCC6IlOzoHuNoThjSix1ME/7qGgoJ4xXM3dtx1kdxZv7VbvZHDIiFBAvDZd3qN65+AIj/0X6sZVfP8fJ+97Od13qfPkrm2tq2bQkj4ZU8Yfde1lMbqMPR3CFRE1BJYw20I4rerF0fl6kevoQ==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass
smtp.mailfrom=uchc.edu; dmarc=pass action=none header.from=uchc.edu;
dkim=pass header.d=uchc.edu; arc=none
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=uchc.onmicrosoft.com;
s=selector2-uchc-onmicrosoft-com;
h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
bh=jzAdo/6FVbenEX9KcaxIP40SI7ibLEFAgQx+2k+LFfE=;
b=In+JFslohTKaUPcf5RJrRZpXElb0AK5RBTFubKIY2l5d5q2azmUjsL3ZZmBkjT3OlWXndPRmffeD7si/rNNQnrEF0HFTBsM1MEZdMxy/tsNE+Y32iPJHC6cHhd9uZ4Xlu9TzGB19PLYu1PwebgGzC9ZA6rybmhlX5JepzlKpygY=
Thread-Topic: What should go to stdout/stderr and why Python logging write
everything to stderr?
Thread-Index: AQHZH4lCw/HkTWJw5E+8f8AhSG81gq6NBCgAgAAWMf8=
In-Reply-To: <CACL+1asMm6Lo8rh7avK8sLTTo69r69mgyMi=nKnHArwsHOr4Lw@mail.gmail.com>
Accept-Language: en-US
Content-Language: en-US
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
x-ms-publictraffictype: Email
x-ms-traffictypediagnostic: SJ0PR14MB5864:EE_|BY5PR14MB3686:EE_
x-ms-office365-filtering-correlation-id: f9e47bbc-eb96-42a9-e3af-08daedc3fef3
x-ms-exchange-senderadcheck: 1
x-ms-exchange-antispam-relay: 0
x-microsoft-antispam: BCL:0;
x-microsoft-antispam-message-info: t9c20QgC7OrmMaJhV8DXvpb6L2RajcMw/3WxzJrawyW3F1T0Ent8YjN6kRMgnxBVjlJhIgbOdzPJkhYw3PpLnfrYv/7wAhFWbfT6u9vIQ6SmqS7b1JcbYYwrA4GPzcZVm4je0ha1blqijrGRhI/nclImMyXt2JtThTWdCIhoFIlw9G+ZdeAJz0aj//mc9QX356cKpICesPAMmcYSE2lhE+6HpIc3y7KZ5hWNur2m4epc1bucnaJNUYz2OE7YWQbUUaVPmwC1pWtF/138LodWmixJDe4X1j4oC3HpfMTcFlhEfNYgIRXXkPt0fDsCspStPwTYGtmuLAEEyvUh4bm49CaEvzkeF1nOfQGdtVvhIB3X61Jr1zKieMNFW9nuhRVBc1R415eSl5rv1U4xAMCwIs5b0KEKYWWBSjCfsACTfAjsAf8p63f1OenN9fQHJ9e7xKikDOYlMt0Vn+tUd/Aw9t2b7EVzcl9IHktBWAgQ+WGVSmQ6V2Eo/CoXh6yTlQVLYQf3BeV6AN4/4g3hnG7WYDbQUwetzwjPLqkY2+waFRN70i4S9OyWJk2z/wFq6MMRawnMYkTdZDeOcfD2lUlYTUGBKFDM5vHDUMy/IM4K5nrN0WAIGFXHRgSJDduTqgEm0OsZ6qjK5IPxnFWkBB/TrrxalyT6tBb9lWHe/+myOyXMch02QHEI/K1V5fDnHm1aKyS4C69JwTZaLi5XBIeAQhPDw/fFtM7yOz+IF9WUkIOWV8O5zVbS+hYrejRrAb4c
x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:;
IPV:NLI; SFV:NSPM; H:SJ0PR14MB5864.namprd14.prod.outlook.com; PTR:; CAT:NONE;
SFS:(13230022)(4636009)(136003)(366004)(396003)(39850400004)(376002)(346002)(451199015)(33656002)(8936002)(2906002)(122000001)(38100700002)(41300700001)(5660300002)(52536014)(166002)(83380400001)(86362001)(966005)(66556008)(76116006)(91956017)(66946007)(110136005)(66476007)(38070700005)(7696005)(71200400001)(53546011)(786003)(41320700001)(6506007)(75432002)(55016003)(478600001)(4326008)(316002)(9686003)(186003)(26005)(64756008)(8676002)(66446008)(22166006);
DIR:OUT; SFP:1101;
x-ms-exchange-antispam-messagedata-chunkcount: 1
x-ms-exchange-antispam-messagedata-0: 0k1as74tB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fS7Kj1T5R9+2Pep/FiGZuTAb0d4FFXsupZhY/9BLx3ngedXPLwL
8tVGryvjazNRilZUDc1nR1PBsThIU30dyWyuXgl+FG40yUnpKLhlzCyU
6aWkWslBG7NkzS45QbwQl3zVwaAGvKx41VarDqernVVQKEKxKu4kM38h
t0+CI2RtdyGm6eJI40WvxwOPGY/8pPXBQIDBM+2kqmAwKgaPL5puSNKe
1M2vR3FEQUsKZKye5jw1iN6AVRs2lXNKPkhQCez6+DmKrRXsuiZHptRq
+02EHqCGRQCVOZgJmhpdKDq2JvTa1si3pqGXXBmK3S0Q8x5fPv3QIL79
J6jZYLkpWFb3fq/lpEdepDgaY4Q3aRuRaFLPh/P8j6/DdrmyqbmEj4rC
pV0+2zMJXj6LRHY2Gxc7SKPfSXeZlqOUDgYYT4LmX5H7aM9lT2f6ROug
bAoSnSoa+XqJf0x2AnzTVyTrOpUln1IrSQ5T4ImKE1eISF3ZVNwWlakj
VGljibQBBDAvpSh4R9bFC4gogKyWlhVcxr5xJw6SBpFWCHCEzd6S/Q
==
X-MS-Exchange-CrossTenant-AuthAs: Internal
X-MS-Exchange-CrossTenant-AuthSource: SJ0PR14MB5864.namprd14.prod.outlook.com
X-MS-Exchange-CrossTenant-Network-Message-Id: f9e47bbc-eb96-42a9-e3af-08daedc3fef3
X-MS-Exchange-CrossTenant-originalarrivaltime: 03 Jan 2023 19:52:07.7523 (UTC)
X-MS-Exchange-CrossTenant-fromentityheader: Hosted
X-MS-Exchange-CrossTenant-id: 5c82d83a-818a-4c16-b540-ded2344a7ad3
X-MS-Exchange-CrossTenant-mailboxtype: HOSTED
X-MS-Exchange-CrossTenant-userprincipalname: tsjDqfi8Go0S36uXXZVuoxHK7DP7etAwH68iAQVDLfhZWJqrpUF1hmMEH5Uik0JbyrQXzHn53Gnx2v95ZxySSw==
X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR14MB3686
X-Proofpoint-GUID: Agr8I2dpZpSDWiuBi15LtBq_jSAmFi71
X-Proofpoint-ORIG-GUID: Agr8I2dpZpSDWiuBi15LtBq_jSAmFi71
X-Proofpoint-Virus-Version: vendor=baseguard
engine=ICAP:2.0.205,Aquarius:18.0.923,Hydra:6.0.545,FMLib:17.11.122.1
definitions=2023-01-03_07,2023-01-03_02,2022-06-22_01
X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0
impostorscore=0
lowpriorityscore=0 adultscore=0 suspectscore=0 malwarescore=0 mlxscore=0
phishscore=0 spamscore=0 priorityscore=1501 clxscore=1011 mlxlogscore=999
bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1
engine=8.12.0-2212070000 definitions=main-2301030170
X-Content-Filtered-By: Mailman/MimeDel 2.1.39
X-BeenThere: python-list@python.org
X-Mailman-Version: 2.1.39
Precedence: list
List-Id: General discussion list for the Python programming language
<python-list.python.org>
List-Unsubscribe: <https://mail.python.org/mailman/options/python-list>,
<mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive: <https://mail.python.org/pipermail/python-list/>
List-Post: <mailto:python-list@python.org>
List-Help: <mailto:python-list-request@python.org?subject=help>
List-Subscribe: <https://mail.python.org/mailman/listinfo/python-list>,
<mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID: <SJ0PR14MB5864C922F2299A8391140D36B9F49@SJ0PR14MB5864.namprd14.prod.outlook.com>
X-Mailman-Original-References: <4NmcJ022hFz6tpm@submission01.posteo.de>
<CACL+1asMm6Lo8rh7avK8sLTTo69r69mgyMi=nKnHArwsHOr4Lw@mail.gmail.com>
 by: Weatherby,Gerard - Tue, 3 Jan 2023 19:52 UTC

If sys.stdout is a tty, it typically flushes on newline. e. g.

!/usr/bin/env python3
import time
import sys
print("No flush",end='',file=sys.stdout)
time.sleep(2)
print("flushed",file=sys.stdout)
time.sleep(5)

will print the “flushed” 5 seconds before the script ends

From: Python-list <python-list-bounces+gweatherby=uchc.edu@python.org> on behalf of Eryk Sun <eryksun@gmail.com>
Date: Tuesday, January 3, 2023 at 1:33 PM
To: c.buhtz@posteo.jp <c.buhtz@posteo.jp>
Cc: python-list@python.org <python-list@python.org>
Subject: Re: What should go to stdout/stderr and why Python logging write everything to stderr?
*** Attention: This is an external email. Use caution responding, opening attachments or clicking on links. ***

On 1/3/23, c.buhtz@posteo.jp <c.buhtz@posteo.jp> wrote:
>
> If the user request the usage info via "-h" it goes to stdout.

The standard file for application output is sys.stdout. Note that
sys.stdout may be buffered, particularly if it isn't a tty. When a
file is buffered, writes are aggregated and only written to the OS
file when the buffer fills up or is manually flushed.

> Why does logging behave different? DEBUG and INFO imho should go to
> stdout not stderr.

The standard file for error messages and other diagnostic information
is sys.stderr. This file should never be buffered.
--
https://urldefense.com/v3/__https://mail.python.org/mailman/listinfo/python-list__;!!Cn_UX_p3!jGBVNrRuUThZCKMmShbuvBgggwv7FBDL9h2vW-vvehPnBHdfkrJUhohhZCgsCAqlRrDluk9c526jABrLjg$<https://urldefense.com/v3/__https:/mail.python.org/mailman/listinfo/python-list__;!!Cn_UX_p3!jGBVNrRuUThZCKMmShbuvBgggwv7FBDL9h2vW-vvehPnBHdfkrJUhohhZCgsCAqlRrDluk9c526jABrLjg$>


devel / comp.lang.python / Re: What should go to stdout/stderr and why Python logging write everything to stderr?

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor