Re: Best (simplest) way to share data between processes

2024-07-07 Thread Piergiorgio Sartor via Python-list
On 06/07/2024 09.28, Chris Green wrote: I have a Raspberry Pi in my boat that uses I2C to read a number of voltages and currents (using ADS1115 A2D) so I can monitor the battery condition etc. At present various different scripts (i.e. processes) just read the values using the I2C bus whenever

Re: venvs vs. package management

2024-05-19 Thread Piergiorgio Sartor via Python-list
On 19/05/2024 08.49, Peter J. Holzer wrote: [...] That's what package management on Linux is for. Sure, it means that you won't have the newest version of anything and some packages not at all, but you don't have to care about dependencies. Or updates. Well, that doesn't work as well.

Re: Terminal Emulator (Posting On Python-List Prohibited)

2024-05-18 Thread Piergiorgio Sartor via Python-list
On 18/05/2024 20.04, Mats Wichmann wrote: [...] So venvs make managing all that pretty convenient. Dunno why everybody's so down on venvs... Only people which are *not* using python... :-) In my experience, venvs is the only possible way to use python properly. The dependency nightmare

Re: Terminal Emulator

2024-05-18 Thread Piergiorgio Sartor via Python-list
On 14/05/2024 19.44, Gordinator wrote: I wish to write a terminal emulator in Python. I am a fairly competent Python user, and I wish to try a new project idea. What references can I use when writing my terminal emulator? I wish for it to be a true terminal emulator as well, not just a Tk text

Re: A technique from a chatbot

2024-04-02 Thread Piergiorgio Sartor via Python-list
On 02/04/2024 19.18, Stefan Ram wrote: Some people can't believe it when I say that chatbots improve my programming productivity. So, here's a technique I learned from a chatbot! It is a structured "break". "Break" still is a kind of jump, you know? So, what's a

Re: Multiplication

2024-04-01 Thread Piergiorgio Sartor via Python-list
On 01/04/2024 10.40, Stefan Ram wrote: Q: How can I multiply two variables in Python? I tried: a = 2 b = 3 print( ab ) but it did not work. A: No, this cannot work. To multiply, you need the multiplication operator. You can import the multiplication operator from

Re: Can one output something other than 'nan' for not a number values?

2024-02-18 Thread Piergiorgio Sartor via Python-list
On 16/02/2024 23.12, Chris Green wrote: I'm looking for a simple way to make NaN values output as something like '-' or even just a space instead of the string 'nan'. This would then make it much easier to handle outputting values from sensors when not all sensors are present. So, for example,

Re: Extract lines from file, add to new files

2024-01-11 Thread Piergiorgio Sartor via Python-list
On 11/01/2024 19.08, Rich Shepard wrote: It's been several years since I've needed to write a python script so I'm asking for advice to get me started with a brief script to separate names and email addresses in one file into two separate files: salutation.txt and emails.txt. An example of the

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 =

Re: Context without manager

2023-11-27 Thread Piergiorgio Sartor via Python-list
On 26/11/2023 18.50, Dieter Maurer wrote: Piergiorgio Sartor wrote at 2023-11-25 22:15 +0100: ... Apparently, the "with" context manager is not usable in classes, at least not with __init__() & co. You can use `with` in classes -- with any context manager. However, you would usually not use

Context without manager

2023-11-26 Thread Piergiorgio Sartor via Python-list
Hi all, I apologize in advance for the "foggy" question, but I've myself unclear ideas. Anyway... Python has "context manager". For example, the "open()" class can be simply used as follow: with open(...) as fp: fp.do_something() On the other hand, it is also possible to do: fp = open()

Re: []=[]

2023-09-25 Thread Piergiorgio Sartor via Python-list
On 23/09/2023 09.41, Stefan Ram wrote: r...@zedat.fu-berlin.de (Stefan Ram) writes: []=[] I was watching a video of a David Beazley talk "Python Concurrency From the Ground Up" , where he wrote can_recv, can_send, [] = select(recv_wait, send_wait, []) . Later, he clarified that he

Re: Trouble with defaults and timeout decorator

2023-06-24 Thread Piergiorgio Sartor via Python-list
On 24/06/2023 18.18, Jason Friedman wrote: I'm writing a database connectivity module to be used by other modules and leveraging the jaydebeapi module. From what I can tell jaydebeapi contains no built-in timeout capability, so then I turned to https://pypi.org/project/timeout-decorator/. My