Re: PyGILState_Ensure() deadlocks, why?

2024-07-08 Thread Barry Scott via Python-list
> On 7 Jul 2024, at 23:21, Barry via Python-list wrote: > > > >> On 7 Jul 2024, at 22:09, Tomas Ukkonen via Python-list >> wrote: >> >>Py_Initialize(); > > You also need to tell python to init threading. I'm in front of my dev machine now and checking up on threading. There is no

Re: fCONV_AUSRICHTG is not defined - Why?

2023-11-08 Thread Egon Frerich via Python-list
Am 07.11.23 um 20:10 schrieb MRAB via Python-list: On 2023-11-07 18:30, dn via Python-list wrote: On 08/11/2023 06.47, Egon Frerich via Python-list wrote: I've no idea why this happens. In a module there are lists and definitions: ... ["%s%s%s " % (i[fCONV_AUSRICHTG], i[fLG

Re: fCONV_AUSRICHTG is not defined - Why?

2023-11-07 Thread Greg Ewing via Python-list
On 8/11/23 8:10 am, MRAB wrote: Something to do with how scoping is implemented in comprehensions? Yes, together with the way class scopes work during class construction. Behind the scenes, the body of a listcomp happens to be implemented as a nested function. Usually you don't notice this,

Re: fCONV_AUSRICHTG is not defined - Why?

2023-11-07 Thread MRAB via Python-list
On 2023-11-07 20:56, Thomas Passin via Python-list wrote: On 11/7/2023 3:29 PM, MRAB via Python-list wrote: On 2023-11-07 19:20, Jim Schwartz via Python-list wrote: Where do you define fCONV_AUSRICHTG? It must be initialized or defined somewhere. Did you leave out a statement from the python 2

Re: fCONV_AUSRICHTG is not defined - Why?

2023-11-07 Thread Thomas Passin via Python-list
. A simplified example: >>> S1 = 'string 1' >>> S2 = 'string 2' >>> (fS1, fS2) = list(range(2)) >>> fS1 0 >>> >>> fS2 1 On Nov 7, 2023, at 1:06 PM, Thomas Passin via Python-list wrote: On 11/7/2023 12:47 PM, Egon Frerich via Python-

Re: fCONV_AUSRICHTG is not defined - Why?

2023-11-07 Thread MRAB via Python-list
no idea why this happens. In a module there are lists and definitions: Felder = [ # Name lg1 lg2 typ Ausrichtung Holen Prüfen Prüfvorg ["Jahr", 4, 5, "u", "", "right", "center"], ["Monat", 2, 5, "

Re: fCONV_AUSRICHTG is not defined - Why?

2023-11-07 Thread Jim Schwartz via Python-list
n-list wrote: >> I've no idea why this happens. In a module there are lists and definitions: >> Felder = [ >> # Name lg1 lg2 typ Ausrichtung Holen Prüfen Prüfvorg >> ["Jahr", 4, 5, "u", "", "right", "c

Re: fCONV_AUSRICHTG is not defined - Why?

2023-11-07 Thread MRAB via Python-list
On 2023-11-07 18:30, dn via Python-list wrote: On 08/11/2023 06.47, Egon Frerich via Python-list wrote: I've no idea why this happens. In a module there are lists and definitions: ...     ["%s%s%s " % (i[fCONV_AUSRICHTG], i[fLG2], i[fTYP]) for i in Felder])   File "/home/ego

Re: fCONV_AUSRICHTG is not defined - Why?

2023-11-07 Thread Thomas Passin via Python-list
On 11/7/2023 12:47 PM, Egon Frerich via Python-list wrote: I've no idea why this happens. In a module there are lists and definitions:     Felder = [     # Name   lg1  lg2 typ   Ausrichtung Holen Prüfen Prüfvorg     ["Jahr", 4, 5, "u", "", "righ

Re: fCONV_AUSRICHTG is not defined - Why?

2023-11-07 Thread dn via Python-list
On 08/11/2023 06.47, Egon Frerich via Python-list wrote: I've no idea why this happens. In a module there are lists and definitions: ...     ["%s%s%s " % (i[fCONV_AUSRICHTG], i[fLG2], i[fTYP]) for i in Felder])   File "/home/egon/Entw/Geldspur/geldspur/gui/GUI_Konf

fCONV_AUSRICHTG is not defined - Why?

2023-11-07 Thread Egon Frerich via Python-list
I've no idea why this happens. In a module there are lists and definitions:     Felder = [     # Name   lg1  lg2 typ   Ausrichtung Holen Prüfen Prüfvorg     ["Jahr", 4, 5, "u", "", "right", "center"],     ["Monat",

Re: Why doc call `__init__` as a method rather than function?

2023-09-18 Thread scruel tao via Python-list
Thanks for all repliers: @Tony & @Cameron, I do know related stuffs about the dunder methods, and your explanation just make it to be more clear, thank you! @Roel, you just caught everyone here, we do miss it even though we know it and use it regularly! @Clara > its both, depending on how

Re: Why doc call `__init__` as a method rather than function?

2023-09-18 Thread Roel Schroeven via Python-list
Op 15/09/2023 om 15:05 schreef anthony.flury via Python-list: Like all of the other methods you shouldn't ever need to call them directly : these are called dunder methods and represent functions and features which are called by other operators. The only recommended way to call

Re: Why doc call `__init__` as a method rather than function?

2023-09-17 Thread Cameron Simpson via Python-list
On 15Sep2023 10:49, scruel tao wrote: ```python class A: ... def __init__(self): ... pass ... ``` On many books and even the official documents, it seems that many authors prefer to call `__init__` as a "method" rather than a "function". The book PYTHON CRASH COURSE mentioned that "A

Re: Why doc call `__init__` as a method rather than function?

2023-09-17 Thread Chris Angelico via Python-list
On Mon, 18 Sept 2023 at 13:49, anthony.flury via Python-list wrote: > > > > To me __init__ is a method, but that is implemented internally as > function associated to a class > What is a method, if it is not a function associated with a class? ChrisA --

Re: Why doc call `__init__` as a method rather than function?

2023-09-17 Thread anthony.flury via Python-list
attributes would be reset to whatever the __init__ sets them to - if you need to do that it might be better to have a reset method. Regards, Tony -- Original Message -- From: "scruel tao via Python-list" To: "python-list@python.org" Sent: Friday, 15 Sep, 23 At 11

Re: Why doc call `__init__` as a method rather than function?

2023-09-15 Thread Alan Gauld via Python-list
On 15/09/2023 11:49, scruel tao via Python-list wrote: > ```python class A: > ... def __init__(self): > ... pass > On many books and even the official documents, it seems that > many authors prefer to call `__init__` as a "method" rather > than a "function". That' because in OOP

Re: Why doc call `__init__` as a method rather than function?

2023-09-15 Thread Clara Spealman via Python-list
` A.__init__` tells that `__init__` is a > function... > > I wonder how can I call `__init__` as? Consider the output above. > Maybe both are OK? If you prefer or think that we must use one of the two, > please explain the why, I really want to know, thanks! > -- > https://mail

Re: Why doc call `__init__` as a method rather than function?

2023-09-15 Thread Dan Sommers via Python-list
ells that `__init__` is a > function... I always call __init__ "the initializer." YMMV. > I wonder how can I call `__init__` as? Consider the output above. > Maybe both are OK? If you prefer or think that we must use one of the two, > please explain the why, I really want

Why doc call `__init__` as a method rather than function?

2023-09-15 Thread scruel tao via Python-list
uot;function". The book PYTHON CRASH COURSE mentioned that "A function that’s part of a class is a method.", however, ` A.__init__` tells that `__init__` is a function... I wonder how can I call `__init__` as? Consider the output above. Maybe both are OK? If you prefer or think th

Re: Why do I always get an exception raised in this __init__()?

2023-09-03 Thread Chris Green via Python-list
Alan Gauld wrote: > On 31/08/2023 22:15, Chris Green via Python-list wrote: > > > class Gpiopin: > > > > def __init__(self, pin): > > # > > # > > # scan through the GPIO chips to find the line/pin we want > > # > > for

Re: Why do I always get an exception raised in this __init__()?

2023-09-01 Thread Alan Gauld via Python-list
On 31/08/2023 22:15, Chris Green via Python-list wrote: > class Gpiopin: > > def __init__(self, pin): > # > # > # scan through the GPIO chips to find the line/pin we want > # > for c in ['gpiochip0', 'gpiochip1',

Re: Why do I always get an exception raised in this __init__()?

2023-08-31 Thread Larry Martell via Python-list
line.name()) > > def set(self): > self.line.set_value(1) > > def clear(self): > self.line.set_value(0) > > > This is by no means the final code, the print() in the __init__() is > just a diagnostic for example. However I really can't understand why I >

Why do I always get an exception raised in this __init__()?

2023-08-31 Thread Chris Green via Python-list
_init__() is just a diagnostic for example. However I really can't understand why I see the following when I try it:- >>> import ngp >>> ngp.Gpiopin("P9_23") Found: P9_23 Traceback (most recent call last): File "", line 1, in File "/h

Re: Why do I always get an exception raised in this __init__()?

2023-08-31 Thread Chris Green via Python-list
Chris Green wrote: [snip code and question] Sorry folks, it was a caching problem, I wasn't running the code I thought I was running! When I made sure I had cleared everything out and tried again it all worked as I expected. -- Chris Green · --

Re: Why does IDLE use a subprocess?

2023-05-31 Thread James Schaffler via Python-list
On Tuesday, May 30th, 2023 at 10:18 PM, Chris Angelico wrote: > Yep, what you're seeing there is the namespace and nothing else. But > if you mess with an actual builtin object, it'll be changed for the > other interpreter too. > > > > > import ctypes > > > > ctypes.cast(id(42),

Re: Why does IDLE use a subprocess?

2023-05-30 Thread Chris Angelico
On Wed, 31 May 2023 at 12:03, James Schaffler via Python-list wrote: > > On Tuesday, May 30th, 2023 at 9:14 PM, Greg Ewing wrote: > > Globals you create by executing code in the REPL have their own > > namespace. But everything else is shared -- builtins, imported > > Python modules, imported C

Re: Why does IDLE use a subprocess?

2023-05-30 Thread James Schaffler via Python-list
On Tuesday, May 30th, 2023 at 9:14 PM, Greg Ewing wrote: > Globals you create by executing code in the REPL have their own > namespace. But everything else is shared -- builtins, imported > Python modules, imported C extension modules, etc. etc. Thanks for the explanation. Could you elaborate on

Re: Why does IDLE use a subprocess?

2023-05-30 Thread Greg Ewing via Python-list
On 29/05/23 8:10 am, James Schaffler wrote: However, some minimal testing of InteractiveInterpreter leads me to believe that the Interpreter object has its own view of local/global variables and therefore shouldn't be able to affect the calling interpreter Globals you create by executing

Re: Why does IDLE use a subprocess?

2023-05-30 Thread Chris Angelico
On Wed, 31 May 2023 at 08:16, Barry wrote: > I don’t think it security but robustness that needs the subprocess. > > Also if your code use tk then it would conflict with idle’s use of tk. > From my memory, it's precisely this - it's much MUCH easier to allow you to use Tk in your own program

Re: Why does IDLE use a subprocess?

2023-05-30 Thread Barry
iew of > local/global variables and therefore shouldn't be able to affect the calling > interpreter (please correct me if I'm wrong). > > So my question is a combination of "Why does IDLE use a subprocess?" and "Why > is InteractiveInterpreter not secureuldenough?"

Why does IDLE use a subprocess?

2023-05-30 Thread James Schaffler via Python-list
tself." However, some minimal testing of InteractiveInterpreter leads me to believe that the Interpreter object has its own view of local/global variables and therefore shouldn't be able to affect the calling interpreter (please correct me if I'm wrong). So my question is a combination o

Re: Why doesn't Python (error msg) tell me WHAT the actual (arg) values are ?

2023-02-25 Thread Weatherby,Gerard
of Peter J. Holzer Date: Saturday, February 25, 2023 at 5:21 PM To: python-list@python.org Subject: Re: Why doesn't Python (error msg) tell me WHAT the actual (arg) values are ? On 2023-02-25 21:58:18 +, Weatherby,Gerard wrote: > I only use asserts for things I know to be true. Yeah, tha

Re: Why doesn't Python (error msg) tell me WHAT the actual (arg) values are ?

2023-02-25 Thread Peter J. Holzer
On 2023-02-25 21:58:18 +, Weatherby,Gerard wrote: > I only use asserts for things I know to be true. Yeah, that's what assers are for. Or rather for things that you *think* are true. > In other words, a failing assert means I have a hole in my program > logic. Yes, if you include your

Re: Why doesn't Python (error msg) tell me WHAT the actual (arg) values are ?

2023-02-25 Thread Weatherby,Gerard
, February 25, 2023 at 9:22 AM To: python-list@python.org Subject: Re: Why doesn't Python (error msg) tell me WHAT the actual (arg) values are ? On 2023-02-25 09:10:06 -0500, Thomas Passin wrote: > On 2/25/2023 1:13 AM, Peter J. Holzer wrote: > > On 2023-02-24 18:19:52 -0500, Thomas Pas

Re: Why doesn't Python (error msg) tell me WHAT the actual (arg) values are ?

2023-02-25 Thread Peter J. Holzer
On 2023-02-25 09:10:06 -0500, Thomas Passin wrote: > On 2/25/2023 1:13 AM, Peter J. Holzer wrote: > > On 2023-02-24 18:19:52 -0500, Thomas Passin wrote: > > > Sometimes you can use a second parameter to assert if you know what kind > > > of > > > error to expect: [...] > > > With type errors,

Re: Why doesn't Python (error msg) tell me WHAT the actual (arg) values are ?

2023-02-25 Thread Thomas Passin
On 2/25/2023 1:13 AM, Peter J. Holzer wrote: On 2023-02-24 18:19:52 -0500, Thomas Passin wrote: On 2/24/2023 2:47 PM, dn via Python-list wrote: On 25/02/2023 08.12, Peter J. Holzer wrote: On 2023-02-24 16:12:10 +1300, dn via Python-list wrote: In some ways, providing this information seems

Re: Why doesn't Python (error msg) tell me WHAT the actual (arg) values are ?

2023-02-24 Thread Peter J. Holzer
On 2023-02-24 18:19:52 -0500, Thomas Passin wrote: > On 2/24/2023 2:47 PM, dn via Python-list wrote: > > On 25/02/2023 08.12, Peter J. Holzer wrote: > > > On 2023-02-24 16:12:10 +1300, dn via Python-list wrote: > > > > In some ways, providing this information seems appropriate. > > > > Curiously,

Re: Why doesn't Python (error msg) tell me WHAT the actual (arg) values are ?

2023-02-24 Thread Thomas Passin
On 2/24/2023 2:47 PM, dn via Python-list wrote: On 25/02/2023 08.12, Peter J. Holzer wrote: On 2023-02-24 16:12:10 +1300, dn via Python-list wrote: In some ways, providing this information seems appropriate. Curiously, this does not even occur during an assert exception - despite the

Re: Why doesn't Python (error msg) tell me WHAT the actual (arg) values are ?

2023-02-24 Thread Peter J. Holzer
On 2023-02-25 08:47:00 +1300, dn via Python-list wrote: > That said, have observed coders 'graduating' from other languages, making > wider use of assert - assumed to be more data (value) sanity-checks than > typing, but ... > > Do you use assert frequently? Not very often, but I do use it.

Re: Why doesn't Python (error msg) tell me WHAT the actual (arg) values are ?

2023-02-24 Thread dn via Python-list
On 25/02/2023 08.12, Peter J. Holzer wrote: On 2023-02-24 16:12:10 +1300, dn via Python-list wrote: In some ways, providing this information seems appropriate. Curiously, this does not even occur during an assert exception - despite the value/relationship being the whole point of using the

Re: Why doesn't Python (error msg) tell me WHAT the actual (arg) values are ?

2023-02-24 Thread Peter J. Holzer
On 2023-02-24 16:12:10 +1300, dn via Python-list wrote: > In some ways, providing this information seems appropriate. Curiously, this > does not even occur during an assert exception - despite the > value/relationship being the whole point of using the command! > > x = 1 > assert x == 2 >

Re: Why doesn't Python (error msg) tell me WHAT the actual (arg) values are ?

2023-02-24 Thread Peter J. Holzer
On 2023-02-23 20:32:26 -0700, Michael Torrie wrote: > On 2/23/23 01:08, Hen Hanna wrote: > > Python VM is seeing an "int" object (123) (and telling me that) > > ... so it should be easy to print that "int" object What does > > Python VMknow ? and when does it know it ? > It knows

Re: Why doesn't Python (error msg) tell me WHAT the actual (arg) values are ?

2023-02-24 Thread Peter J. Holzer
r: can only concatenate str (not "int") to str > > > > > > Why doesn't Python (error msg) do the obvious thing and tell me > > WHAT the actual (offending, arg) values are ? > > > > In many cases, it'd help to know what string the var A had , when t

RE: Why doesn't Python (error msg) tell me WHAT the actual (arg) values are ?

2023-02-23 Thread avi.e.gross
We have been supplying many possible reasons or consequences for why the implementation of python does not do what the OP wants and even DEMANDS. I am satisfied with knowing it was because they CHOSE NOT TO in some places and maybe not in others. It is nice to see some possible reasons

Re: Why doesn't Python (error msg) tell me WHAT the actual (arg) values are ?

2023-02-23 Thread Michael Torrie
On 2/23/23 01:08, Hen Hanna wrote: > Python VM is seeing an "int" object (123) (and telling me that) ... > so it should be easy to print that "int" object > What does Python VMknow ? and when does it know it ? It knows there is an object and its name and type. It knows this from

Re: Why doesn't Python (error msg) tell me WHAT the actual (arg) values are ?

2023-02-23 Thread dn via Python-list
On 23/02/2023 09.05, Hen Hanna wrote: > py bug.py Traceback (most recent call last): File "C:\Usenet\bug.py", line 5, in print( a + 12 ) TypeError: can only concatenate str (not "int") to str Why doesn't

RE: Why doesn't Python (error msg) tell me WHAT the actual (arg) values are ?

2023-02-23 Thread avi.e.gross
wn. -Original Message- From: Python-list On Behalf Of Rob Cliffe via Python-list Sent: Wednesday, February 22, 2023 4:31 PM To: python-list@python.org Subject: Re: Why doesn't Python (error msg) tell me WHAT the actual (arg) values are ? On 22/02/2023 20:05, Hen Hanna wrote: > P

Re: Why doesn't Python (error msg) tell me WHAT the actual (arg) values are ?

2023-02-23 Thread Rob Cliffe via Python-list
On 22/02/2023 20:05, Hen Hanna wrote: Python makes programming (debugging) so easy I agree with that! Rob Cliffe -- https://mail.python.org/mailman/listinfo/python-list

Re: Why doesn't Python (error msg) tell me WHAT the actual (arg) values are ?

2023-02-23 Thread Hen Hanna
na wrote: > >>>> py bug.py > >>> Traceback (most recent call last): > >>> File "C:\Usenet\bug.py", line 5, in > >>> print( a + 12 ) > >>> TypeError: can only concatenate str (not "int") to str > >>> &

Re: Why doesn't Python (error msg) tell me WHAT the actual (arg) values are ?

2023-02-23 Thread Barry
>>> File "C:\Usenet\bug.py", line 5, in >>> print( a + 12 ) >>> TypeError: can only concatenate str (not "int") to str >>> >>> >>> Why doesn't Python (error msg) do the obvious thing and tell me >>> WHAT the act

Re: Why doesn't Python (error msg) tell me WHAT the actual (arg) values are ?

2023-02-22 Thread Hen Hanna
print( a + 12 ) > > TypeError: can only concatenate str (not "int") to str > > > > > > Why doesn't Python (error msg) do the obvious thing and tell me > > WHAT the actual (offending, arg) values are ? > > > > In many cases, it'd help to know what s

Re: Why doesn't Python (error msg) tell me WHAT the actual (arg) values are ?

2023-02-22 Thread Thomas Passin
On 2/22/2023 6:46 PM, Hen Hanna wrote: On Wednesday, February 22, 2023 at 12:05:34 PM UTC-8, Hen Hanna wrote: py bug.py Traceback (most recent call last): File "C:\Usenet\bug.py", line 5, in print( a + 12 ) TypeError: can only concatenate str (not "int") to str Why doesn

Re: Why doesn't Python (error msg) tell me WHAT the actual (arg) values are ?

2023-02-22 Thread Hen Hanna
On Wednesday, February 22, 2023 at 12:05:34 PM UTC-8, Hen Hanna wrote: > > py bug.py > Traceback (most recent call last): > File "C:\Usenet\bug.py", line 5, in > print( a + 12 ) > TypeError: can only concatenate str (not "int") to str > > >

RE: Why doesn't Python (error msg) tell me WHAT the actual (arg) values are ?

2023-02-22 Thread avi.e.gross
Hen or Hanna, You keep asking WHY which may be reasonable but hard or irrelevant in many cases. I find the traceback perfectly informative. It says you asked it to print NOT just "a" but "a + 12" and the error is coming not from PRINT but from trying to invoke addition

Why doesn't Python (error msg) tell me WHAT the actual (arg) values are ?

2023-02-22 Thread Hen Hanna
> py bug.py Traceback (most recent call last): File "C:\Usenet\bug.py", line 5, in print( a + 12 ) TypeError: can only concatenate str (not "int") to str Why doesn't Python (error msg) do the ob

Re: why is a search thru a Tuple slower ? ---- (meaningless indentations)

2023-02-20 Thread Michael Torrie
On 2/20/23 18:01, Hen Hanna wrote: > is Comp.Lang.Python very active Fairly. Apparently the cool kids are using the Python Discourse forum. > why is a linear search thru a Tuple slower > (than thru a (corresponding) List ) ??? I cannot say, unfo

why is a search thru a Tuple slower ? ---- (meaningless indentations)

2023-02-20 Thread Hen Hanna
is Comp.Lang.Python very active why is a linear search thru a Tuple slower (than thru a (corresponding) List ) ??? sometimes, i 'd like to put meaningless indentations like i do (twice) below ( how

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

2023-01-06 Thread Weatherby,Gerard
FWIW, it wasn’t too difficult to build a logging handler to send messages to Slack. https://pypi.org/project/slack-webclient-logger/ -- https://mail.python.org/mailman/listinfo/python-list

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

2023-01-06 Thread Peter J. Holzer
On 2023-01-05 12:29:33 -0800, Grant Edwards wrote: > On 2023-01-05, Thomas Passin wrote: > > > The logging system is so configurable that... > > I find it almost impossible to use unless I copy a working example I > find somewhere. ;) I usually copy the working example from my previous project

Re: asyncio and tkinter (was: What should go to stdout/stderr and why Python logging write everything to stderr?)

2023-01-05 Thread Thomas Passin
On 1/5/2023 7:52 PM, Stefan Ram wrote: Thomas Passin writes: On 1/5/2023 4:24 PM, Stefan Ram wrote: You often can replace threads in tkinter by coroutines using asyncio when you write a replacement for the mainloop of tkinter that uses asyncio. Now, try to read only the official documentation

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

2023-01-05 Thread Thomas Passin
On 1/5/2023 4:24 PM, Stefan Ram wrote: You often can replace threads in tkinter by coroutines using asyncio when you write a replacement for the mainloop of tkinter that uses asyncio. Now, try to read only the official documentation of asyncio and tkinter and figure out only from

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

2023-01-05 Thread Thomas Passin
ogging.basicConfig(level=logging.DEBUG) >>> logging.info('So should this') INFO:root:So should this : Finally! Not quite straightforward, though it is in the Howto. Now about those handlers ... From: Python-list on behalf of Grant Edwards Date: Thursday, January 5, 2023 at 3:31 P

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

2023-01-05 Thread Grant Edwards
On 2023-01-05, Weatherby,Gerard wrote: > logging.basicConfig() > logging.info(“Nice to know”) > logging.debug(“Details for when things are funky”) > logging.warn(“Trouble is brewing”) I always seem to need something slightly more complex. Usually something like: * Specify a log level on the

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

2023-01-05 Thread Weatherby,Gerard
/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 2023-01-05, Thomas Passin wrote: > The logging system is so configurable that... I find it almost impossible to use unles

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

2023-01-05 Thread Thomas Passin
On 1/5/2023 3:29 PM, Grant Edwards wrote: On 2023-01-05, Thomas Passin wrote: The logging system is so configurable that... I find it almost impossible to use unless I copy a working example I find somewhere. ;) I'm not at all surprised that the OP didn't understand how it works. I've been

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

2023-01-05 Thread Grant Edwards
On 2023-01-05, Thomas Passin wrote: > The logging system is so configurable that... I find it almost impossible to use unless I copy a working example I find somewhere. ;) I'm not at all surprised that the OP didn't understand how it works. I've been writing Python programs for over 20 years,

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

2023-01-05 Thread Thomas Passin
On 1/5/2023 2:18 PM, Peter J. Holzer wrote: On 2023-01-05 08:31:40 -0500, Thomas Passin wrote: The logging system is so configurable that a user could set a different destination for each level of logging. So it seems that the O.P.'s original question about why the package's developers choose

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

2023-01-05 Thread Peter J. Holzer
On 2023-01-05 08:31:40 -0500, Thomas Passin wrote: > The logging system is so configurable that a user could set a different > destination for each level of logging. So it seems that the O.P.'s original > question about why the package's developers choose stderr for all levels can >

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

2023-01-05 Thread Thomas Passin
o it seems that the O.P.'s original question about why the package's developers choose stderr for all levels can be answered: "They didn't". -- https://mail.python.org/mailman/listinfo/python-list

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

2023-01-05 Thread Peter J. Holzer
On 2023-01-04 12:32:40 -0500, Thomas Passin wrote: > On 1/3/2023 10:35 AM, c.bu...@posteo.jp wrote: > > The logging module write everything to stderr no matter which logging > > level is used. > > The OP wrote this, but it's not so by default. By default it is - sort of. That is all log

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

2023-01-04 Thread Chris Angelico
ke all log levels go to stdout. Just DEBUG and > > INFO. But this would be a workaround. > > > > The main question here is why does Python deciecded to make all logs > > go to stderr? > > Maybe I totally misunderstood the intention of logging.info()?! Isn't > >

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

2023-01-04 Thread Barry Scott
question here is why does Python deciecded to make all logs go to stderr? Maybe I totally misunderstood the intention of logging.info()?! Isn't this the "usual applicaton output"? If not, what messages should go into logging.info()? Can you name me some examples? Example: wr

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

2023-01-04 Thread Barry Scott
question here is why does Python deciecded to make all logs go to stderr? Maybe I totally misunderstood the intention of logging.info()?! Isn't this the "usual applicaton output"? If not, what messages should go into logging.info()? Can you name me some examples? It is up to you, th

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

2023-01-04 Thread Thomas Passin
On 1/3/2023 10:35 AM, c.bu...@posteo.jp wrote: The logging module write everything to stderr no matter which logging level is used. The OP wrote this, but it's not so by default. There is a HOW-TO page that explains this and how to get the logging package to log everything to a file, along

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

2023-01-04 Thread Peter J. Holzer
On 2023-01-03 21:24:20 +, c.bu...@posteo.jp wrote: > The main question here is why does Python deciecded to make all logs go to > stderr? It doesn't. The Python logging system provides a plethora of handlers to log to lots of different places. Only the StreamHandler defaults to w

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

2023-01-04 Thread Peter J. Holzer
On 2023-01-04 16:46:37 +1100, Chris Angelico wrote: > On Wed, 4 Jan 2023 at 15:11, Eryk Sun wrote: > > On 1/3/23, Chris Angelico wrote: > > > writing the FD is the same as using stdout > > > > Except stdout may be buffered. Maybe I'm overly lax in my terminology, but I frequently use the term

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

2023-01-04 Thread Barry Scott
On 04/01/2023 06:46, Chris Angelico wrote: I've known some systems to have a trigger of "reading on FD 0 flushes FD 1" C++ has this feature: Quote from https://en.cppreference.com/w/cpp/io/cin "Once |std::cin| is constructed, std::cin.tie() returns ::cout

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

2023-01-04 Thread Barry Scott
On 04/01/2023 02:26, Chris Angelico wrote: Reading/writing the FD is the same as using stdout (technically you'd write to fd 1 and read from fd 0), but yes, can use /dev/tty to reach for the console directly. I think the logic is more like checking that stdin is a tty then using the tty it

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

2023-01-04 Thread 2QdxY4RzWzUUiLuE
On 2023-01-04 at 12:02:55 +, "Weatherby,Gerard" wrote: > Dealing with stdout / stderr is bash is just syntax. I don’t always > remember it off the top of my head but … stackoverflow.com. https://tldp.org/LDP/abs/html/io-redirection.html > On Linux at least it’s possible to pipe to

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

2023-01-04 Thread Weatherby,Gerard
nuary 3, 2023 at 5:18 PM To: 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. *** Maybe some day an interface and

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

2023-01-03 Thread Chris Angelico
On Wed, 4 Jan 2023 at 17:26, Eryk Sun wrote: > > On 1/3/23, Chris Angelico wrote: > > > > FDs can also be buffered. If it's buffering you want to avoid, don't > > mess around with exactly which one you're writing to, just flush. > > I meant to flush a C FILE stream or Python file before writing

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

2023-01-03 Thread Eryk Sun
On 1/3/23, Chris Angelico wrote: > > FDs can also be buffered. If it's buffering you want to avoid, don't > mess around with exactly which one you're writing to, just flush. I meant to flush a C FILE stream or Python file before writing directly to the file descriptor, in order to avoid

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

2023-01-03 Thread Eryk Sun
On 1/3/23, Grant Edwards wrote: > > That's definitely a better option, but I'm pretty sure I've seen > multiple examples over the decades where fd 0 was used instead. Was > /dev/tty a "recent" enough invention that I would have seen > application code that was written before it existed? Or maybe

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

2023-01-03 Thread Chris Angelico
enough invention that I would have seen > application code that was written before it existed? Or maybe I was > just looking at code written by people who weren't aware of /dev/tty? No idea. Probably. It's definitely possible that someone tries it with stdout redirected and goes "

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

2023-01-03 Thread Chris Angelico
On Wed, 4 Jan 2023 at 15:11, Eryk Sun wrote: > > On 1/3/23, Chris Angelico wrote: > > > > writing the FD is the same as using stdout > > Except stdout may be buffered. One should probably flush the buffer > before each raw write to the file descriptor. FDs can also be buffered. If it's

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

2023-01-03 Thread Grant Edwards
On 2023-01-04, Chris Angelico wrote: > On Wed, 4 Jan 2023 at 09:52, Grant Edwards wrote: >> >>> I can't think of a specific example, but I know I have piped the output >>> of a program while at the same time interacting with a prompt on stderr. >>> A rare thing, though. >> >> Programs that ask

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

2023-01-03 Thread Eryk Sun
On 1/3/23, Chris Angelico wrote: > > writing the FD is the same as using stdout Except stdout may be buffered. One should probably flush the buffer before each raw write to the file descriptor. > use /dev/tty to reach for the console directly. On Windows, open "CON" (read or write), "CONIN$"

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

2023-01-03 Thread Chris Angelico
On Wed, 4 Jan 2023 at 10:28, Stefan Ram wrote: > > c.bu...@posteo.jp writes: > >But I don't want to make all log levels go to stdout. Just DEBUG and > >INFO. > > The following was stripped down from something some guy > posted on a web site, maybe it was "rkachach". Yet another shining

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

2023-01-03 Thread Chris Angelico
On Wed, 4 Jan 2023 at 09:52, Grant Edwards wrote: > > On 2023-01-03, Michael Torrie wrote: > > On 1/3/23 11:45, Keith Thompson wrote: > >> MRAB writes: > >> [...] > >>> The purpose of stderr is to display status messages, logging and error > >>> messages, even user prompts, and not mess up the

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

2023-01-03 Thread Grant Edwards
On 2023-01-03, Michael Torrie wrote: > On 1/3/23 11:45, Keith Thompson wrote: >> MRAB writes: >> [...] >>> The purpose of stderr is to display status messages, logging and error >>> messages, even user prompts, and not mess up the program's actual >>> output. This is important on a *nix system

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

2023-01-03 Thread Chris Angelico
On Wed, 4 Jan 2023 at 09:17, Michael Torrie wrote: > > On 1/3/23 11:45, Keith Thompson wrote: > > MRAB writes: > > [...] > >> The purpose of stderr is to display status messages, logging and error > >> messages, even user prompts, and not mess up the program's actual > >> output. This is

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

2023-01-03 Thread 2QdxY4RzWzUUiLuE
On 2023-01-03 at 21:24:20 +, c.bu...@posteo.jp wrote: > The main question here is why does Python deciecded to make all logs > go to stderr? It makes sense to send all logging to one destination, and stderr is that place. > Maybe I totally misunderstood the intention of log

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

2023-01-03 Thread Michael Torrie
On 1/3/23 11:45, Keith Thompson wrote: > MRAB writes: > [...] >> The purpose of stderr is to display status messages, logging and error >> messages, even user prompts, and not mess up the program's actual >> output. This is important on a *nix system where you might be piping >> the output of

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

2023-01-03 Thread Chris Angelico
On Wed, 4 Jan 2023 at 08:25, wrote: > > Am 03.01.2023 17:51 schrieb r...@zedat.fu-berlin.de: > > logging.getLogger().addHandler( logging.StreamHandler( sys.stdout )) > > But I don't want to make all log levels go to stdout. Just DEBUG and > INFO. But this would be a workaroun

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

2023-01-03 Thread Cameron Simpson
uld expect. Error messages to stderr. _Requested output_ to stdout. Good with me. Why does logging behave different? DEBUG and INFO imho should go to stdout not stderr. I entirely disagree. Consider a shell pipeline: cmd1 | cmd2 | cmd3 where `cmd2` and `cmd3` parse data coming down the pipe

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

2023-01-03 Thread c . buhtz
Am 03.01.2023 17:51 schrieb r...@zedat.fu-berlin.de: logging.getLogger().addHandler( logging.StreamHandler( sys.stdout )) But I don't want to make all log levels go to stdout. Just DEBUG and INFO. But this would be a workaround. The main question here is why does Python deciecded to make

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

2023-01-03 Thread Eryk Sun
On 1/3/23, Weatherby,Gerard wrote: > If sys.stdout is a tty, it typically flushes on newline. e. g. Sorry if I wasn't clear. Yes, a tty file will be buffered, but it's line buffering, which isn't an issue as long as lines are written to stdout. I was referring to full buffering of pipe and disk

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

2023-01-03 Thread Weatherby,Gerard
s From: Python-list on behalf of Eryk Sun Date: Tuesday, January 3, 2023 at 1:33 PM To: c.bu...@posteo.jp Cc: 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,

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

2023-01-03 Thread Thomas Passin
On 1/3/2023 11:51 AM, Stefan Ram wrote: Thomas Passin writes: On 1/3/2023 10:35 AM, c.bu...@posteo.jp wrote: Also, I think it would be confusing to sometimes have logging output go to stdout and other times go to stderr. In UNIX, the output of a program can be redirected, so error

  1   2   3   4   5   6   7   8   9   10   >