Re: How to manage accented characters in mail header?

2025-01-06 Thread Peter J. Holzer via Python-list
On 2025-01-04 19:07:57 +, Chris Green via Python-list wrote: > Stefan Ram wrote: > > Chris Green wrote or quoted: > > >From: =?utf-8?B?U8OpYmFzdGllbiBDcmlnbm9u?= > > > Is there a simple[r] way to extract just the 'real' address between > the <>, that's all I actually need. I think it has t

Re: How to manage accented characters in mail header?

2025-01-06 Thread Peter Pearson via Python-list
On Sat, 4 Jan 2025 14:31:24 +, Chris Green wrote: > I have a Python script that filters my incoming E-Mail. It has been > working OK (with various updates and improvements) for many years. > > I now have a minor new problem when handling E-Mail with a From: that > has accented characters in i

Re: How to manage accented characters in mail header?

2025-01-06 Thread Chris Green via Python-list
Stefan Ram wrote: > Chris Green wrote or quoted: > >From: =?utf-8?B?U8OpYmFzdGllbiBDcmlnbm9u?= > > In Python, when you roll with decode_header from the email.header > module, it spits out a list of parts, where each part is like > a tuple of (decoded string, charset). To smash these decod

Re: How to go about describing my software with a component diagram?

2024-12-25 Thread dn via Python-list
On 25/12/24 10:05, marc nicole wrote: > I want to convey the idea that main.py (main algorithm) imports 3 > modules (V, S, M) (each of them containing .py scripts related to > different functionalities) and use their methods accordingly as per the > requirement: basically the structure of my code

Re: How to go about describing my software with a component diagram?

2024-12-25 Thread marc nicole via Python-list
the purpose of the diagram is to convey a minimalistic idea about the structure of the code/implementation/software Le mer. 25 déc. 2024 à 01:49, Thomas Passin via Python-list < python-list@python.org> a écrit : > On 12/24/2024 3:42 PM, marc nicole via Python-list wrote: > > it is here https://i.

Re: How to go about describing my software with a component diagram?

2024-12-24 Thread Thomas Passin via Python-list
On 12/24/2024 3:42 PM, marc nicole via Python-list wrote: it is here https://i.sstatic.net/ykk5Wd0w.png This diagram does not make much sense to me: 1. What is the purpose of the diagram and who is it intended for? 2. A module and an algorithm are different kinds of things, yet they are conne

Re: How to go about describing my software with a component diagram?

2024-12-24 Thread George Fischhof via Python-list
marc nicole via Python-list ezt írta (időpont: 2024. dec. 24., K 22:09): > The full python package (pypi) being represented as the outermost frame > here including the 4 sub-frames) > > Le mar. 24 déc. 2024 à 22:05, marc nicole a écrit : > > > I want to convey the idea that main.py (main algorit

Re: How to go about describing my software with a component diagram?

2024-12-24 Thread Thomas Passin via Python-list
On 12/24/2024 4:08 PM, marc nicole via Python-list wrote: The full python package (pypi) being represented as the outermost frame here including the 4 sub-frames) Le mar. 24 déc. 2024 à 22:05, marc nicole a écrit : I want to convey the idea that main.py (main algorithm) imports 3 modules (V,

Re: How to go about describing my software with a component diagram?

2024-12-24 Thread marc nicole via Python-list
The full python package (pypi) being represented as the outermost frame here including the 4 sub-frames) Le mar. 24 déc. 2024 à 22:05, marc nicole a écrit : > I want to convey the idea that main.py (main algorithm) imports 3 modules > (V, S, M) (each of them containing .py scripts related to > d

Re: How to go about describing my software with a component diagram?

2024-12-24 Thread marc nicole via Python-list
I want to convey the idea that main.py (main algorithm) imports 3 modules (V, S, M) (each of them containing .py scripts related to different functionalities) and use their methods accordingly as per the requirement: basically the structure of my code and how the modules relate to each other. Le m

Re: How to go about describing my software with a component diagram?

2024-12-24 Thread dn via Python-list
On 25/12/24 06:27, marc nicole via Python-list wrote: Hello community, I have created a Python code where a main algorithm uses three different modules (.py) after importing them. To illustrate and describe it I have created the following component diagram? [image: checkso.PNG] Could it be i

Re: How to go about describing my software with a component diagram?

2024-12-24 Thread dn via Python-list
On 25/12/24 08:00, Michael Torrie via Python-list wrote: On 12/24/24 10:27 AM, marc nicole via Python-list wrote: the diagram is also attached here This text-only mailing list does not allow attachments, just FYI. Many devs use Markdown (or similar) text-only file-formats for technical doc

Re: How to go about describing my software with a component diagram?

2024-12-24 Thread marc nicole via Python-list
it is here https://i.sstatic.net/ykk5Wd0w.png Le mar. 24 déc. 2024 à 20:03, Michael Torrie via Python-list < python-list@python.org> a écrit : > On 12/24/24 10:27 AM, marc nicole via Python-list wrote: > > the diagram is also attached here > > This text-only mailing list does not allow attachment

Re: How to go about describing my software with a component diagram?

2024-12-24 Thread Michael Torrie via Python-list
On 12/24/24 10:27 AM, marc nicole via Python-list wrote: > the diagram is also attached here This text-only mailing list does not allow attachments, just FYI. -- https://mail.python.org/mailman/listinfo/python-list

Re: How to go about describing my software with a component diagram?

2024-12-24 Thread marc nicole via Python-list
the diagram is also attached here Le mar. 24 déc. 2024 à 18:27, marc nicole a écrit : > Hello community, > > I have created a Python code where a main algorithm uses three different > modules (.py) after importing them. > > To illustrate and describe it I have created the following component > d

Re: How to catch a fatal error in Python 2.7?

2024-12-09 Thread Michael Torrie via Python-list
On 12/9/24 12:19 PM, marc nicole via Python-list wrote: > Hello, > > The fatal error exits the program with a code -1 while referencing the > memory address involved and nothing else. > > How to catch it in Python 2.7? Does the problem occur with Python 3.x? At this date, Python 2.7 is only sup

Re: How to check whether audio bytes contain empty noise or actual voice/signal?

2024-10-28 Thread Lars Liedtke via Python-list
There are also the concepts of Cepstrum (https://en.wikipedia.org/wiki/Cepstrum) and Quefrency, which are derivatives of Spectrum and Frequency, with which you can even do speaker-recognition, but also detection of events. Lars Liedtke Lead Developer [Tel.] +49 721 98993- [Fax] +49 721 98

Re: How to check whether audio bytes contain empty noise or actual voice/signal?

2024-10-26 Thread Thomas Passin via Python-list
On 10/25/2024 12:25 PM, marc nicole via Python-list wrote: Hello Python fellows, I hope this question is not very far from the main topic of this list, but I have a hard time finding a way to check whether audio data samples are containing empty noise or actual significant voice/noise. I am usi

Re: How to check whether audio bytes contain empty noise or actual voice/signal?

2024-10-26 Thread MRAB via Python-list
On 2024-10-25 17:25, marc nicole via Python-list wrote: Hello Python fellows, I hope this question is not very far from the main topic of this list, but I have a hard time finding a way to check whether audio data samples are containing empty noise or actual significant voice/noise. I am using

Re: How to stop a specific thread in Python 2.7?

2024-09-26 Thread Left Right via Python-list
That's one of the "disadvantages" of threads: you cannot safely stop a thread. Of course you could try, but that's never a good idea. The reason for this is that threads share memory. They might be holding locks that, if killed, will never be unlocked. They might (partially) modify the shared state

Re: How to stop a specific thread in Python 2.7?

2024-09-25 Thread Cameron Simpson via Python-list
On 25Sep2024 22:56, marc nicole wrote: How to create a per-thread event in Python 2.7? Every time you make a Thread, make an Event. Pass it to the thread worker function and keep it to hand for your use outside the thread. -- https://mail.python.org/mailman/listinfo/python-list

Re: How to stop a specific thread in Python 2.7?

2024-09-25 Thread marc nicole via Python-list
How to create a per-thread event in Python 2.7? On Wed, 25 Sept 2024, 22:47 Cameron Simpson via Python-list, < python-list@python.org> wrote: > On 25Sep2024 19:24, marc nicole wrote: > >I want to know how to kill a specific running thread (say by its id) > > > >for now I run and kill a thread li

Re: How to stop a specific thread in Python 2.7?

2024-09-25 Thread Cameron Simpson via Python-list
On 25Sep2024 19:24, marc nicole wrote: I want to know how to kill a specific running thread (say by its id) for now I run and kill a thread like the following: # start thread thread1 = threading.Thread(target= self.some_func(), args=( ...,), ) thread1.start() # kill the thread event_thread1 = t

Re: how to discover what values produced an exception?

2024-05-06 Thread Chris Angelico via Python-list
On Tue, 7 May 2024 at 03:38, Alan Bawden via Python-list wrote: > A good error message shouldn't withhold any information that can > _easily_ be included. Debugging is more art than science, so there is > no real way to predict what information might prove useful in solving > the crime. I emphas

Re: how to discover what values produced an exception?

2024-05-06 Thread Left Right via Python-list
From a practical perspective: not all values are printable (especially if printing a value results in an error: then you'd lose the original error, so, going crazy with printing of errors is usually not such a hot idea). But, if you want the values: you'd have to examine the stack, extract the val

Re: how to discover what values produced an exception?

2024-05-06 Thread Alan Bawden via Python-list
Thomas Passin writes: On 5/3/2024 9:56 AM, Johanne Fairchild via Python-list wrote: > How to discover what values produced an exception? Or perhaps---why > doesn't the Python traceback show the values involved in the TypeError? > For instance: > > --8<--

Re: how to discover what values produced an exception?

2024-05-04 Thread Dan Sommers via Python-list
On 2024-05-03 at 10:56:39 -0300, Johanne Fairchild via Python-list wrote: > How to discover what values produced an exception? Or perhaps---why > doesn't the Python traceback show the values involved in the TypeError? > For instance: > > --8<-

Re: how to discover what values produced an exception?

2024-05-04 Thread Dieter Maurer via Python-list
Johanne Fairchild wrote at 2024-5-3 10:56 -0300: >How to discover what values produced an exception? Or perhaps---why >doesn't the Python traceback show the values involved in the TypeError? >For instance: > >--8<>8--- (0,0) < 4 >Traceba

Re: how to discover what values produced an exception?

2024-05-03 Thread Thomas Passin via Python-list
On 5/3/2024 9:56 AM, Johanne Fairchild via Python-list wrote: How to discover what values produced an exception? Or perhaps---why doesn't the Python traceback show the values involved in the TypeError? For instance: --8<>8--- (0,0) < 4 T

Re: How to Add ANSI Color to User Response

2024-04-13 Thread Pierre Fortin via Python-list
On Thu, 11 Apr 2024 05:00:32 +0200 Gisle Vanem via Python-list wrote: >Pierre Fortin wrote: > >> Over the years, I've tried different mechanisms for applying colors until >> I got my hands on f-stings; then I created a tiny module with all the >> colors (cR, cG, etc) which made my life so much sim

Re: How to Add ANSI Color to User Response

2024-04-12 Thread Gisle Vanem via Python-list
Pierre Fortin wrote: Over the years, I've tried different mechanisms for applying colors until I got my hands on f-stings; then I created a tiny module with all the colors (cR, cG, etc) which made my life so much simpler (attached). Attachments are stripped off in this list. It would be nice t

Re: How to Add ANSI Color to User Response

2024-04-11 Thread Cameron Simpson via Python-list
On 10Apr2024 23:41, Alan Gauld wrote: Normally, for any kind of fancy terminal work, I'd say use curses. My problem with curses is that it takes over the whole terminal - you need to manage everything from that point on. Great if you want it (eg some full-terminal tool like `top`) but comple

Re: How to Add ANSI Color to User Response

2024-04-10 Thread Thomas Passin via Python-list
On 4/10/2024 6:41 PM, Alan Gauld via Python-list wrote: On 10/04/2024 19:50, WordWeaver Evangelist via Python-list wrote: I have a simple question. I use the following textPrompt in some of my Jython modules: '\nYour choice is? (A B C D E): ', maxChars=1, autoAccept=False, forceUpper

Re: How to Add ANSI Color to User Response

2024-04-10 Thread Grant Edwards via Python-list
On 2024-04-10, Alan Gauld via Python-list wrote: > On 10/04/2024 19:50, WordWeaver Evangelist via Python-list wrote: > >> I have a simple question. I use the following textPrompt in some of my >> Jython modules: >> '\nYour choice is? (A B C D E): ', maxChars=1, autoAccept=False, >> force

Re: How to Add ANSI Color to User Response

2024-04-10 Thread David via Python-list
On Wed, 10 Apr 2024 at 18:51, WordWeaver Evangelist via Python-list wrote: > I have a simple question. I use the following textPrompt in some of my > Jython modules: > '\n [1;33mYour choice is? (A B C D E): ', maxChars=1, autoAccept=False, > forceUppercase=True) > Is there a way to add an ANS

Re: How to Add ANSI Color to User Response

2024-04-10 Thread Pierre Fortin via Python-list
On Thu, 11 Apr 2024 04:50:49 +1000 WordWeaver Evangelist via Python-list wrote: >Hello List, > >I have a simple question. I use the following textPrompt in some of my Jython >modules: > '\nYour choice is? (A B C D E): ', maxChars=1, autoAccept=False, > forceUppercase=True) >Is there a way

Re: How to Add ANSI Color to User Response

2024-04-10 Thread Alan Gauld via Python-list
On 10/04/2024 19:50, WordWeaver Evangelist via Python-list wrote: > I have a simple question. I use the following textPrompt in some of my Jython > modules: > '\nYour choice is? (A B C D E): ', maxChars=1, autoAccept=False, > forceUppercase=True) > Is there a way to add an ANSI color cod

Re: How to Add ANSI Color to User Response

2024-04-10 Thread dn via Python-list
On 11/04/24 06:50, WordWeaver Evangelist via Python-list wrote: I have a simple question. I use the following textPrompt in some of my Jython modules: '\nYour choice is? (A B C D E): ', maxChars=1, autoAccept=False, forceUppercase=True) Is there a way to add an ANSI color code to the e

Re: How to Add ANSI Color to User Response

2024-04-10 Thread Grant Edwards via Python-list
On 2024-04-10, WordWeaver Evangelist via Python-list wrote: > I have a simple question. I use the following textPrompt in some of my Jython > modules: > '\nYour choice is? (A B C D E): ', maxChars=1, autoAccept=False, > forceUppercase=True) > Is there a way to add an ANSI color code t

Re: How to create a binary tree hierarchy given a list of elements as its leaves

2024-01-28 Thread MRAB via Python-list
On 2024-01-28 18:16, marc nicole via Python-list wrote: So I am trying to build a binary tree hierarchy given numerical elements serving for its leaves (last level of the tree to build). From the leaves I want to randomly create a name for the higher level of the hierarchy and assign it to the ch

Re: How to replace a cell value with each of its contour cells and yield the corresponding datasets seperately in a list according to a Pandas-way?

2024-01-21 Thread Thomas Passin via Python-list
On 1/21/2024 1:25 PM, marc nicole wrote: It is part of a larger project aiming at processing data according to a given algorithm Do you have any comments or any enhancing recommendations on the code? I'm not knowledgeable enough about either pandas or numpy, I'm afraid, just very basic usage.

Re: How to replace a cell value with each of its contour cells and yield the corresponding datasets seperately in a list according to a Pandas-way?

2024-01-21 Thread marc nicole via Python-list
It is part of a larger project aiming at processing data according to a given algorithm Do you have any comments or any enhancing recommendations on the code? Thanks. Le dim. 21 janv. 2024 à 18:28, Thomas Passin via Python-list < python-list@python.org> a écrit : > On 1/21/2024 11:54 AM, marc ni

Re: How to replace a cell value with each of its contour cells and yield the corresponding datasets seperately in a list according to a Pandas-way?

2024-01-21 Thread Thomas Passin via Python-list
On 1/21/2024 11:54 AM, marc nicole wrote: Thanks for the reply, I think using a Pandas (or a Numpy) approach would optimize the execution of the program. Target cells could be up to 10% the size of the dataset, a good example to start with would have from 10 to 100 values. Thanks for the r

Re: How to replace a cell value with each of its contour cells and yield the corresponding datasets seperately in a list according to a Pandas-way?

2024-01-21 Thread marc nicole via Python-list
Thanks for the reply, I think using a Pandas (or a Numpy) approach would optimize the execution of the program. Target cells could be up to 10% the size of the dataset, a good example to start with would have from 10 to 100 values. Let me know your thoughts, here's a reproducible example which I

Re: How to replace a cell value with each of its contour cells and yield the corresponding datasets seperately in a list according to a Pandas-way?

2024-01-21 Thread Thomas Passin via Python-list
On 1/21/2024 7:37 AM, marc nicole via Python-list wrote: Hello, I have an initial dataframe with a random list of target cells (each cell being identified with a couple (x,y)). I want to yield four different dataframes each containing the value of one of the contour (surrounding) cells of each s

Re: How to enter multiple, similar, dictionaries?

2023-12-11 Thread Piergiorgio Sartor via Python-list
On 11/12/2023 16.16, Chris Green wrote: Is there a way to abbreviate the following code somehow? lv = {'dev':'bbb', 'input':'1', 'name':'Leisure volts'} sv = {'dev':'bbb', 'input':'0', 'name':'Starter volts'} la = {'dev':'bbb', 'input':'2', 'name':'Leisure Amps'} sa = {'dev':

Re: How to enter multiple, similar, dictionaries?

2023-12-11 Thread Chris Green via Python-list
Jon Ribbens wrote: > On 2023-12-11, Chris Green wrote: > > Chris Green wrote: > >> Is there a way to abbreviate the following code somehow? > >> > >> lv = {'dev':'bbb', 'input':'1', 'name':'Leisure volts'} > >> sv = {'dev':'bbb', 'input':'0', 'name':'Starter volts'} > >> la = {'dev'

Re: How to enter multiple, similar, dictionaries?

2023-12-11 Thread Jon Ribbens via Python-list
On 2023-12-11, Chris Green wrote: > Chris Green wrote: >> Is there a way to abbreviate the following code somehow? >> >> lv = {'dev':'bbb', 'input':'1', 'name':'Leisure volts'} >> sv = {'dev':'bbb', 'input':'0', 'name':'Starter volts'} >> la = {'dev':'bbb', 'input':'2', 'name':'Leisu

Re: How to enter multiple, similar, dictionaries?

2023-12-11 Thread MRAB via Python-list
On 2023-12-11 15:57, Chris Green via Python-list wrote: Chris Green wrote: Is there a way to abbreviate the following code somehow? lv = {'dev':'bbb', 'input':'1', 'name':'Leisure volts'} sv = {'dev':'bbb', 'input':'0', 'name':'Starter volts'} la = {'dev':'bbb', 'input':'2', 'name'

Re: How to enter multiple, similar, dictionaries?

2023-12-11 Thread Grant Edwards via Python-list
On 2023-12-11, Chris Green via Python-list wrote: > Is there a way to abbreviate the following code somehow? > > lv = {'dev':'bbb', 'input':'1', 'name':'Leisure volts'} > sv = {'dev':'bbb', 'input':'0', 'name':'Starter volts'} > la = {'dev':'bbb', 'input':'2', 'name':'Leisure Amps'} >

Re: How to enter multiple, similar, dictionaries?

2023-12-11 Thread Chris Green via Python-list
Chris Green wrote: > Is there a way to abbreviate the following code somehow? > > lv = {'dev':'bbb', 'input':'1', 'name':'Leisure volts'} > sv = {'dev':'bbb', 'input':'0', 'name':'Starter volts'} > la = {'dev':'bbb', 'input':'2', 'name':'Leisure Amps'} > sa = {'dev':'bbb', 'input'

Re: How to find any documentation for smbus?

2023-10-30 Thread Dieter Maurer via Python-list
Chris Green wrote at 2023-10-28 17:08 +0100: >I am using the python3 smbus module, but it's hard work because of the >lack of documentation. Web searches confirm that the documentation is >somewhat thin! > >If you do the obvious this is what you get:- > >>>> import smbus >>>> dir (smbus) >

Re: How to find any documentation for smbus?

2023-10-30 Thread Chris Green via Python-list
Dan Purgert wrote: > On 2023-10-28, Chris Green wrote: > > I am using the python3 smbus module, but it's hard work because of the > > lack of documentation. Web searches confirm that the documentation is > > somewhat thin! > > > > The SMBus spec is available from http://smbus.org (or at least it

Re: How to find any documentation for smbus?

2023-10-30 Thread km via Python-list
Il Sat, 28 Oct 2023 17:08:00 +0100, Chris Green ha scritto: > I am using the python3 smbus module, but it's hard work because of the > lack of documentation. Web searches confirm that the documentation is > somewhat thin! > > If you do the obvious this is what you get:- > > >>> import smbus

Re: How to find any documentation for smbus?

2023-10-30 Thread Chris Green via Python-list
km wrote: > Il Sat, 28 Oct 2023 17:08:00 +0100, Chris Green ha scritto: > > > I am using the python3 smbus module, but it's hard work because of the > > lack of documentation. Web searches confirm that the documentation is > > somewhat thin! > > > > If you do the obvious this is what you get:-

Re: How to sort this without 'cmp=' in python 3?

2023-10-24 Thread Chris Angelico via Python-list
On Wed, 25 Oct 2023 at 13:02, Mike H via Python-list wrote: > Is it possible to use lambda expression instead of defining a `Key` class? > Something like `sorted(my_list, key = lambda x, y: x+y > y+x)`? Look up functools.cmp_to_key. ChrisA -- https://mail.python.org/mailman/listinfo/python-lis

Re: How to sort this without 'cmp=' in python 3?

2023-10-24 Thread Mike H via Python-list
On Saturday, October 15, 2016 at 12:27:42 AM UTC-7, Peter Otten wrote: > 38016...@gmail.com wrote: > > > nums=['3','30','34','32','9','5'] > > I need to sort the list in order to get the largest number string: > > '953433230' > > > > nums.sort(cmp=lambda a,b: cmp(a+b, b+a), reverse=True) > >

Re: How to write list of integers to file with struct.pack_into?

2023-10-03 Thread Roel Schroeven via Python-list
Jen Kris via Python-list schreef op 2/10/2023 om 17:06: My previous message just went up -- sorry for the mangled formatting.  Here it is properly formatted: I want to write a list of 64-bit integers to a binary file.  Every example I have seen in my research converts it to .txt, but I want

Re: How to write list of integers to file with struct.pack_into?

2023-10-02 Thread Jen Kris via Python-list
Dieter, thanks for your comment that: * In your code, `offset` is `0`, `1`, `2`, ... but it should be `0 *8`, `1 * 8`, `2 * 8`, ... But you concluded with essentially the same solution proposed by MRAB, so that would obviate the need to write item by item because it writes the whole buffer at o

Re: How to write list of integers to file with struct.pack_into?

2023-10-02 Thread Dieter Maurer via Python-list
Jen Kris wrote at 2023-10-2 00:04 +0200: >Iwant to write a list of 64-bit integers to a binary file. Everyexample I >have seen in my research convertsit to .txt, but I want it in binary. I wrote >this code,based on some earlier work I have done: > >buf= bytes((len(qs_array)) * 8) > >for offset

Re: How to write list of integers to file with struct.pack_into?

2023-10-02 Thread Jen Kris via Python-list
Thanks very much, MRAB.  I just tried that and it works.  What frustrated me is that every research example I found writes integers as strings.  That works -- sort of -- but it requires re-casting each string to integer when reading the file.  If I'm doing binary work I don't want the extra over

Re: How to write list of integers to file with struct.pack_into?

2023-10-02 Thread MRAB via Python-list
On 2023-10-01 23:04, Jen Kris via Python-list wrote: > > Iwant to write a list of 64-bit integers to a binary file. Everyexample I have seen in my research convertsit to .txt, but I want it in binary. I wrote this code,based on some earlier work I have done: > > buf= bytes((len(qs_array)) * 8)

Re: How to write list of integers to file with struct.pack_into?

2023-10-02 Thread Barry via Python-list
On 2 Oct 2023, at 16:02, Jen Kris via Python-list wrote: Iwant to write a list of 64-bit integers to a binary file.  Everyexample I have seen in my research convertsit to .txt, but I want it in binary.  I wrote this code,based on some earlier work I have done: buf= b

Re: How to find the full class name for a frame

2023-08-04 Thread Jason Friedman via Python-list
> > Jason Friedman wrote at 2023-8-3 21:34 -0600: > > ... > >my_frame = inspect.currentframe() > > ... > >My question is: let's say I wanted to add a type hint for my_frame. > > `my_frame` will be an instance of `Types.FrameType`. > Confirmed. Thank you! -- https://mail.python.org/mailman/listinf

Re: How to find the full class name for a frame

2023-08-04 Thread Dieter Maurer via Python-list
Jason Friedman wrote at 2023-8-3 21:34 -0600: > ... >my_frame = inspect.currentframe() > ... >My question is: let's say I wanted to add a type hint for my_frame. `my_frame` will be an instance of `Types.FrameType`. -- https://mail.python.org/mailman/listinfo/python-list

Re: How to find the full class name for a frame

2023-08-04 Thread Jason Friedman via Python-list
> My question is: let's say I wanted to add a type hint for my_frame. > > > > my_frame: some_class_name = inspect.currentframe() > > > > What would I put for some_class_name? > > "frame" (without quotations) is not recognized, > > Nor is inspect.frame. > > We know Python code is executed in an exec

Re: How to find the full class name for a frame

2023-08-03 Thread dn via Python-list
On 04/08/2023 15.34, Jason Friedman via Python-list wrote: import inspect def my_example(arg1, arg2): print(inspect.stack()[0][3]) my_frame = inspect.currentframe() args,_,_,values = inspect.getargvalues(my_frame) args_rendered = [f"{x}: {values[x]}" for x in args] print(args_rendered) my_examp

Re: How to add CC and BCC while sending mails using python

2023-06-20 Thread Roel Schroeven via Python-list
sonam Kumari via Python-list schreef op 20/06/2023 om 9:49: > > I've tried the above code and the bcc address does not receive the message, on the To & CC addresses receive it. > > Here are snippets from my code, perhaps something will stand out to you? > > to = 'e...@domain.gov' > cc = 'e..

Re: How to add CC and BCC while sending mails using python

2023-06-20 Thread sonam Kumari via Python-list
On Friday, November 30, 2012 at 7:00:27 AM UTC+5:30, ake...@gmail.com wrote: > On Tuesday, September 30, 2008 8:00:16 AM UTC-8, Bernhard Walle wrote: > > Hi, > > > > * cindy jones [2008-09-30 19:57]: > > > > > > Can someone tel me how to add cc's and bcc's while sending mails using > > > pyth

Re: How to 'ignore' an error in Python?

2023-04-29 Thread Phu Sam
Unsubscribe On Sat, Apr 29, 2023 at 7:05 PM Chris Angelico wrote: > On Sun, 30 Apr 2023 at 11:58, Chris Green wrote: > > > > Chris Angelico wrote: > > > On Sat, 29 Apr 2023 at 14:27, Kushal Kumaran > wrote: > > > > > > > > On Fri, Apr 28 2023 at 04:55:41 PM, Chris Green wrote: > > > > > I'm

Re: How to 'ignore' an error in Python?

2023-04-29 Thread Chris Angelico
On Sun, 30 Apr 2023 at 12:02, jak wrote: > > Chris Angelico ha scritto: > > Using mkdirs when you only want to make one is inviting problems of > > being subtly wrong, where it creates too many levels of directory. > > Personally, I would just do: > > > Maybe I only say this because it has happene

Re: How to 'ignore' an error in Python?

2023-04-29 Thread jak
Stefan Ram ha scritto: jak writes: Maybe I only say this because it has happened to me too many times but before ignoring the error in the 'except' branch, I would make sure that if the name exists it is a folder and not a file. If the name exists and it is a file's name, this will be dete

Re: How to 'ignore' an error in Python?

2023-04-29 Thread Chris Angelico
On Sun, 30 Apr 2023 at 11:58, Chris Green wrote: > > Chris Angelico wrote: > > On Sat, 29 Apr 2023 at 14:27, Kushal Kumaran wrote: > > > > > > On Fri, Apr 28 2023 at 04:55:41 PM, Chris Green wrote: > > > > I'm sure I'm missing something obvious here but I can't see an elegant > > > > way to do

Re: How to 'ignore' an error in Python?

2023-04-29 Thread jak
Chris Angelico ha scritto: Using mkdirs when you only want to make one is inviting problems of being subtly wrong, where it creates too many levels of directory. Personally, I would just do: Maybe I only say this because it has happened to me too many times but before ignoring the error in the

Re: How to 'ignore' an error in Python?

2023-04-29 Thread Chris Green
Kushal Kumaran wrote: > On Fri, Apr 28 2023 at 04:55:41 PM, Chris Green wrote: > > I'm sure I'm missing something obvious here but I can't see an elegant > > way to do this. I want to create a directory, but if it exists it's > > not an error and the code should just continue. > > > > So, I have

Re: How to 'ignore' an error in Python?

2023-04-29 Thread Chris Green
Chris Angelico wrote: > On Sat, 29 Apr 2023 at 14:27, Kushal Kumaran wrote: > > > > On Fri, Apr 28 2023 at 04:55:41 PM, Chris Green wrote: > > > I'm sure I'm missing something obvious here but I can't see an elegant > > > way to do this. I want to create a directory, but if it exists it's > > >

Re: How to 'ignore' an error in Python?

2023-04-29 Thread Greg Ewing via Python-list
On 30/04/23 2:43 am, jak wrote: Maybe I expressed myself badly but I didn't mean to propose alternatives to the EAFP way but just to evaluate the possibility that it is not a folder. If it's not a folder, you'll find out when the next thing you try to do to it fails. You could check for it ear

RE: How to 'ignore' an error in Python?

2023-04-29 Thread avi.e.gross
require a loss of simplicity. -Original Message- From: Python-list On Behalf Of Kushal Kumaran Sent: Saturday, April 29, 2023 12:19 AM To: python-list@python.org Subject: Re: How to 'ignore' an error in Python? On Fri, Apr 28 2023 at 04:55:41 PM, Chris Green wrote: >

Re: How to 'ignore' an error in Python?

2023-04-28 Thread Chris Angelico
On Sat, 29 Apr 2023 at 14:27, Kushal Kumaran wrote: > > On Fri, Apr 28 2023 at 04:55:41 PM, Chris Green wrote: > > I'm sure I'm missing something obvious here but I can't see an elegant > > way to do this. I want to create a directory, but if it exists it's > > not an error and the code should j

Re: How to 'ignore' an error in Python?

2023-04-28 Thread Kushal Kumaran
On Fri, Apr 28 2023 at 04:55:41 PM, Chris Green wrote: > I'm sure I'm missing something obvious here but I can't see an elegant > way to do this. I want to create a directory, but if it exists it's > not an error and the code should just continue. > > So, I have:- > > for dirname in listofdir

Re: How to 'ignore' an error in Python?

2023-04-28 Thread Cameron Simpson
On 28Apr2023 10:39, Mats Wichmann wrote: For this specific case, you can use os.makedirs: os.makedirs(dirname, exist_ok=True) I'm not a great fan of makedirs because it will make all the missing components, not just the final one. So as an example, if you've got a NAS mounted backup area at

Re: How to 'ignore' an error in Python?

2023-04-28 Thread Cameron Simpson
On 28Apr2023 16:55, Chris Green wrote: for dirname in listofdirs: try: os.mkdir(dirname) except FileExistsError: # so what can I do here that says 'carry on regardless' except: # handle any other error, which is really an error # I

Re: How to 'ignore' an error in Python?

2023-04-28 Thread Mats Wichmann
On 4/28/23 11:05, MRAB wrote: On 2023-04-28 16:55, Chris Green wrote: I'm sure I'm missing something obvious here but I can't see an elegant way to do this.  I want to create a directory, but if it exists it's not an error and the code should just continue. So, I have:- for dirname in lis

Re: How to 'ignore' an error in Python?

2023-04-28 Thread MRAB
On 2023-04-28 16:55, Chris Green wrote: I'm sure I'm missing something obvious here but I can't see an elegant way to do this. I want to create a directory, but if it exists it's not an error and the code should just continue. So, I have:- for dirname in listofdirs: try:

Re: How to 'ignore' an error in Python?

2023-04-28 Thread Mats Wichmann
On 4/28/23 09:55, Chris Green wrote: I'm sure I'm missing something obvious here but I can't see an elegant way to do this. I want to create a directory, but if it exists it's not an error and the code should just continue. So, I have:- for dirname in listofdirs: try:

Re: How to add clickable url links to 3D Matplotlib chart ?

2023-03-30 Thread a a
On Thursday, 30 March 2023 at 13:19:51 UTC+2, a a wrote: > On Thursday, 30 March 2023 at 13:14:33 UTC+2, a a wrote: > > On Thursday, 30 March 2023 at 07:55:13 UTC+2, Christian Gollwitzer wrote: > > > Am 30.03.23 um 01:11 schrieb a a: > > > > On Wednesday, 29 March 2023 at 22:51:15 UTC+2, Greg Ew

Re: How to add clickable url links to 3D Matplotlib chart ?

2023-03-30 Thread a a
On Thursday, 30 March 2023 at 13:14:33 UTC+2, a a wrote: > On Thursday, 30 March 2023 at 07:55:13 UTC+2, Christian Gollwitzer wrote: > > Am 30.03.23 um 01:11 schrieb a a: > > > On Wednesday, 29 March 2023 at 22:51:15 UTC+2, Greg Ewing wrote: > > >> On 30/03/23 8:39 am, a a wrote: > > >>> How to

Re: How to add clickable url links to 3D Matplotlib chart ?

2023-03-30 Thread a a
On Thursday, 30 March 2023 at 07:55:13 UTC+2, Christian Gollwitzer wrote: > Am 30.03.23 um 01:11 schrieb a a: > > On Wednesday, 29 March 2023 at 22:51:15 UTC+2, Greg Ewing wrote: > >> On 30/03/23 8:39 am, a a wrote: > >>> How to add clickable url links to the following 3D Matplotlib chart to > >

Re: How to add clickable url links to 3D Matplotlib chart ?

2023-03-30 Thread Christian Gollwitzer
Am 30.03.23 um 01:11 schrieb a a: On Wednesday, 29 March 2023 at 22:51:15 UTC+2, Greg Ewing wrote: On 30/03/23 8:39 am, a a wrote: How to add clickable url links to the following 3D Matplotlib chart to make it knowledge representation 3D chart, make of 1,000+ open Tabs in Firefox ? It seems t

Re: How to add clickable url links to 3D Matplotlib chart ?

2023-03-29 Thread a a
On Wednesday, 29 March 2023 at 22:51:15 UTC+2, Greg Ewing wrote: > On 30/03/23 8:39 am, a a wrote: > > How to add clickable url links to the following 3D Matplotlib chart to make > > it knowledge representation 3D chart, make of 1,000+ open Tabs in Firefox ? > It seems that matplotlib can be made

Re: How to add clickable url links to 3D Matplotlib chart ?

2023-03-29 Thread Greg Ewing via Python-list
On 30/03/23 8:39 am, a a wrote: How to add clickable url links to the following 3D Matplotlib chart to make it knowledge representation 3D chart, make of 1,000+ open Tabs in Firefox ? It seems that matplotlib can be made to generate SVG images with hyperlinks in them: https://matplotlib.org/s

Re: How to get get_body() to work? (about email)

2023-03-20 Thread Jon Ribbens via Python-list
On 2023-03-19, Greg Ewing wrote: > On 20/03/23 7:07 am, Jon Ribbens wrote: >> Ah, apparently it got removed in Python 3, which is a bit odd as the >> last I heard it was added in Python 2.2 in order to achieve consistency >> with other types. > > As far as I remember, the file type came into exist

Re: How to get get_body() to work? (about email)

2023-03-20 Thread Jon Ribbens via Python-list
On 2023-03-19, Stefan Ram wrote: > Jon Ribbens writes: >>(Also, I too find it annoying to have to avoid, but calling a local >>variable 'file' is somewhat suspect since it shadows the builtin.) > > Thanks for your remarks, but I'm not aware > of such a predefined name "file"! Ah, apparently

Re: How to get get_body() to work? (about email)

2023-03-20 Thread Jon Ribbens via Python-list
On 2023-03-19, Stefan Ram wrote: > Peng Yu writes: >>But when I try the following code, get_body() is not found. How to get >>get_body() to work? > > Did you know that this post of mine here was posted to > Usenet with a Python script I wrote? > > That Python script has a function to show t

Re: How to get get_body() to work? (about email)

2023-03-19 Thread Greg Ewing via Python-list
On 20/03/23 7:07 am, Jon Ribbens wrote: Ah, apparently it got removed in Python 3, which is a bit odd as the last I heard it was added in Python 2.2 in order to achieve consistency with other types. As far as I remember, the file type came into existence with type/class unification, and "open"

Re: How to get get_body() to work? (about email)

2023-03-19 Thread Thomas Passin
On 3/18/2023 10:49 PM, Peng Yu wrote: Hi, https://docs.python.org/3/library/email.parser.html It says "For MIME messages, the root object will return True from its is_multipart() method, and the subparts can be accessed via the payload manipulation methods, such as get_body(), iter_parts(), and

Re: How to exit program with custom code and custom message?

2023-03-13 Thread Chris Angelico
On Tue, 14 Mar 2023 at 15:28, Thomas Passin wrote: > > On 3/13/2023 10:34 PM, scruel tao wrote: > > Interesting, `raise SystemExit` seems to have the same behavior as > > `sys.exit`: > > > > ```shell > > python -c "raise SystemExit(100)" > > echo $? > > <<< 100 > > > > python -c " import sys; sys

Re: How to exit program with custom code and custom message?

2023-03-13 Thread Thomas Passin
On 3/13/2023 10:34 PM, scruel tao wrote: Interesting, `raise SystemExit` seems to have the same behavior as `sys.exit`: ```shell python -c "raise SystemExit(100)" echo $? <<< 100 python -c " import sys; sys.exit(100)" echo $? <<< 100 OTOH, you don't want to get too tricky: (on Windows, obvio

Re: How to exit program with custom code and custom message?

2023-03-13 Thread Thomas Passin
On 3/13/2023 11:50 PM, MRAB wrote: On 2023-03-14 03:29, Thomas Passin wrote: On 3/13/2023 10:34 PM, scruel tao wrote: Lars: I totally understand your reasoning here, but in some way it follows the unix philosophy: Do only one thing, but do that good. I understand, python is not strongly typ

Re: How to exit program with custom code and custom message?

2023-03-13 Thread MRAB
On 2023-03-14 03:29, Thomas Passin wrote: On 3/13/2023 10:34 PM, scruel tao wrote: Lars: I totally understand your reasoning here, but in some way it follows the unix philosophy: Do only one thing, but do that good. I understand, python is not strongly typed, so `sys.exit` will be able to ac

  1   2   3   4   5   6   7   8   9   10   >