Re: Lambda returning tuple question, multi-expression

2023-03-10 Thread Thomas Passin
On 3/10/2023 11:15 PM, aapost wrote: On 3/10/23 22:16, Thomas Passin wrote: [...] The additional note in the above is, when taking the def route above, the thing you would have to consider is what scope is the dictionary pids? Do you need to submit it to the lambda and subsequently the functi

Re: Lambda returning tuple question, multi-expression

2023-03-10 Thread aapost
On 3/10/23 22:16, Thomas Passin wrote: On 3/10/2023 7:07 PM, aapost wrote: which does start to break down readability due to line length, as there isn't really an indention rule set for something uncommonly used. but some renaming makes the pattern clearer pids.update({"messages" :subprocess.

Re: Lambda returning tuple question, multi-expression

2023-03-10 Thread Thomas Passin
On 3/10/2023 10:37 PM, 2qdxy4rzwzuui...@potatochowder.com wrote: On 2023-03-10 at 22:16:05 -0500, Thomas Passin wrote: I'd make the pattern in this example even more understandable and less error-prone: def update_pids(target): cmd = ["tail", "-n", "1", "-f", f"/var/log/{target}"] p

Re: Python installation not full and python not working 3.11.0

2023-03-10 Thread Thomas Passin
On 3/10/2023 9:51 PM, Thomas Passin wrote: On 3/10/2023 6:27 PM, Jan Vasko wrote: Please note that you can't attach images in these posts, at least not so we can read them.  Instead, copy the messages from the console and paste them into your post. I suggest that you check to make sure that

Re: Lambda returning tuple question, multi-expression

2023-03-10 Thread 2QdxY4RzWzUUiLuE
On 2023-03-10 at 22:16:05 -0500, Thomas Passin wrote: > I'd make the pattern in this example even more understandable and less > error-prone: > > def update_pids(target): > cmd = ["tail", "-n", "1", "-f", f"/var/log/{target}"] > pids.update({target: subprocess.Popen(cmd)}) if not \ >

Re: Lambda returning tuple question, multi-expression

2023-03-10 Thread Thomas Passin
On 3/10/2023 7:07 PM, aapost wrote: which does start to break down readability due to line length, as there isn't really an indention rule set for something uncommonly used. but some renaming makes the pattern clearer pids.update({"messages" :subprocess.Popen(["cmd1"])}) if not pids["messages

Re: Python installation not full and python not working 3.11.0

2023-03-10 Thread MRAB
On 2023-03-10 23:27, Jan Vasko wrote: Hello all, I would like to ask you for help. I have been using Python 3.8 for almost 2 years and I decided to update to 3.11. Initially everything was correct. But at some point Windows shows me that Python is being reinstalled (I don't have a message pr

Re: Python installation not full and python not working 3.11.0

2023-03-10 Thread Thomas Passin
On 3/10/2023 6:27 PM, Jan Vasko wrote: Please note that you can't attach images in these posts, at least not so we can read them. Instead, copy the messages from the console and paste them into your post. I suggest that you check to make sure that your system hasn't been damaged or corrupte

RE: Python installation not full and python not working 3.11.0

2023-03-10 Thread Jan Vasko
Hello all, I would like to ask you for help. I have been using Python 3.8 for almost 2 years and I decided to update to 3.11. Initially everything was correct. But at some point Windows shows me that Python is being reinstalled (I don't have a message print screen ..), but from that time I can

Re: Lambda returning tuple question, multi-expression

2023-03-10 Thread aapost
On 3/9/23 15:25, Thomas Passin wrote: >>> # this is a code snippet from a Tkinter gui app >>> # in this case lambda is quite convenient >>> self.btn_cancel = Button(self.progress_container, text='Cancel', >>> command=lambda: subprocess.call('taskkill /f /im uberzip.exe', >>> shell=Tr

Re: Lambda returning tuple question, multi-expression

2023-03-10 Thread aapost
On 3/10/23 18:46, aapost wrote:     main.pids.update({"messages" :subprocess.Popen(["tail", "-n", "1", "-f", "/var/log/messages"])}),     main.pids.update({"syslog" :subprocess.Popen(["tail", "-n", "1", "-f", "/var/log/syslog"])}),     main.pids.update({"kern" :subprocess.Popen([

Re: Baffled by readline module

2023-03-10 Thread Cameron Simpson
On 10Mar2023 23:11, Weatherby,Gerard wrote: This is the implementation of cmd.Cmd (Python 3.9). As you can see in cmdloop(), the import is already wrapped, and the readline feature can be turned off explicitly by passing None to the completekey in the constructor. This isn't strictly true, a

Re: Baffled by readline module

2023-03-10 Thread Weatherby,Gerard
This is the implementation of cmd.Cmd (Python 3.9). As you can see in cmdloop(), the import is already wrapped, and the readline feature can be turned off explicitly by passing None to the completekey in the constructor. def __init__(self, completekey='tab', stdin=None, stdout=None):

Problem with wxPython form

2023-03-10 Thread Chris
Hi everyone. I'm new to Python and wxPython. I've got a form I use to calculate the Sq In of a leather project. I'm using python 3.9.13 and wxPython 4.20 I'm having the following issues: 1) When I come into the form, no grid cell has the focus set - I start typing and nothing happens. I have t

Re: Baffled by readline module

2023-03-10 Thread Grant Edwards
On 2023-03-10, Cameron Simpson wrote: > On 10Mar2023 09:12, Grant Edwards wrote: >>On 2023-03-10, Weatherby,Gerard wrote: >>> On our Linux systems, I can up-arrow to go back to prior commands >>> and use the left and right arrows to navigate a line. The >>> functionality may be provided internal

Re: Baffled by readline module

2023-03-10 Thread Cameron Simpson
On 10Mar2023 09:12, Grant Edwards wrote: On 2023-03-10, Weatherby,Gerard wrote: On our Linux systems, I can up-arrow to go back to prior commands and use the left and right arrows to navigate a line. The functionality may be provided internally by readline. I’ve never had to dig into it becaus

Re: Lambda returning tuple question, multi-expression

2023-03-10 Thread Cameron Simpson
On 09Mar2023 17:55, aapost wrote: On 3/9/23 16:37, Cameron Simpson wrote: Just a note that some code formatters use a trailing comma on the last element to make the commas fold points. Both yapf (my preference) and black let you write a line like (and, indeed, flatten if short enough):    

Re: Baffled by readline module

2023-03-10 Thread Eryk Sun
On 3/9/23, Greg Ewing via Python-list wrote: > On 10/03/23 4:00 pm, 2qdxy4rzwzuui...@potatochowder.com wrote: >> My ~/.pythonrc contains the following: >> >> import readline >> import rlcompleter >> readline.parse_and_bind( 'tab: complete' ) > > I don't have a ~/.pythonrc, so that's

Re: Baffled by readline module

2023-03-10 Thread Simon Ward
On Fri, Mar 10, 2023 at 06:37:56AM -0800, Grant Edwards wrote: On 2023-03-10, Weatherby,Gerard wrote: I'll have to remember that one. It doesn't really fit my current use case, but there are others where it would work nicely. However, cmd.Cmd does not provide command recall and editing. Accordi

Re: Baffled by readline module

2023-03-10 Thread Grant Edwards
On 2023-03-10, Weatherby,Gerard wrote: > On our Linux systems, I can up-arrow to go back to prior commands > and use the left and right arrows to navigate a line. The > functionality may be provided internally by readline. I’ve never had > to dig into it because it meets my needs out of the box.

Re: Baffled by readline module

2023-03-10 Thread Weatherby,Gerard
On our Linux systems, I can up-arrow to go back to prior commands and use the left and right arrows to navigate a line. The functionality may be provided internally by readline. I’ve never had to dig into it because it meets my needs out of the box. From: Python-list on behalf of Grant Edward

Re: Baffled by readline module

2023-03-10 Thread Grant Edwards
On 2023-03-10, Weatherby,Gerard wrote: > I would say, “No, readline is not the right tool.” > > cmd.Cmd is: https://docs.python.org/3/library/cmd.html. I have a > couple of cmd.Cmd modules, one of which I use daily and the other > weekly. I'll have to remember that one. It doesn't really fit my

Re: Baffled by readline module

2023-03-10 Thread Weatherby,Gerard
I would say, “No, readline is not the right tool.” cmd.Cmd is: https://docs.python.org/3/library/cmd.html. I have a couple of cmd.Cmd modules, one of which I use daily and the other weekly. From: Python-list on behalf of Grant Edwards Date: Thursday, March 9, 2023 at 2:29 PM To: python-list@p

Re: Baffled by readline module

2023-03-10 Thread gene heskett
On 3/9/23 20:31, 2qdxy4rzwzuui...@potatochowder.com wrote: I was with you until that part of the small wooden box. :-) So was I, but we all put that off as long as we can. I retired 22 years ago. We're not really an industry that has a concept of retirement. Which is why I'm still here (