Re: Strategies for avoiding having to use --break-system-packages with pip

2025-01-17 Thread Peter J. Holzer via Python-list
On 2025-01-14 11:32:35 +, Chris Green via Python-list wrote: > Use a virtual environment, what do I have to do then to make using > my program (that uses tkintertable) 'transparent', i.e. I just > want to be able to run the program from the command prompt like > any other progra

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: No module name mutagen

2025-01-01 Thread Peter J. Holzer via Python-list
On 2024-12-31 15:00:10 -0900, Tim Johnson via Python-list wrote: > being retired for ten years, I get my butt kicked by python dependencies > every time I upgrade ubuntu. (I'm newly on 24.04) now. > > Now, after three weeks on using the following code correctly: > > from mutagen import mp3, id3,

Re: it's a shame... python error over error

2024-12-16 Thread Peter J. Holzer via Python-list
On 2024-12-16 08:08:46 +0100, aotto1968 via Python-list wrote: > On 13.12.24 11:36, aotto1968 wrote: > > it's a shame... > > almost every tool I touch that uses "python" in some way has some > > configuration error because apparently a __private__ python installation > > __isn't__ properly "underst

Re: it's a shame... python error over error

2024-12-14 Thread Peter J. Holzer via Python-list
On 2024-12-13 11:36:01 +0100, aotto1968 via Python-list wrote: > it's a shame... > almost every tool I touch that uses "python" in some way has some > configuration error because apparently a __private__ python installation > __isn't__ properly "understood". > > -> I think after ~30 years *python*

Re: Printing UTF-8 mail to terminal

2024-11-05 Thread Peter J. Holzer via Python-list
On 2024-11-04 13:02:21 +0100, Loris Bennett via Python-list wrote: > "Loris Bennett" writes: > > "Loris Bennett" writes: > >> Cameron Simpson writes: > >>> On 01Nov2024 10:10, Loris Bennett wrote: > as expected. The non-UTF-8 text occurs when I do > > mail = EmailMessage() > >>>

Re: Correct syntax for pathological re.search()

2024-10-21 Thread Peter J. Holzer via Python-list
On 2024-10-19 00:15:23 +0200, jak via Python-list wrote: > Peter J. Holzer ha scritto: > > As a trivial example, the regular expressions r"\\sout{" and r"\\sout\{" > > are equivalent (the \ before the { is redundant). Yet > > re.compile(s).pattern preserves the difference between the two strings. >

Re: Correct syntax for pathological re.search()

2024-10-18 Thread Peter J. Holzer via Python-list
On 2024-10-12 08:51:57 -0400, Thomas Passin via Python-list wrote: > On 10/12/2024 6:59 AM, Peter J. Holzer via Python-list wrote: > > On 2024-10-11 17:13:07 -0400, AVI GROSS via Python-list wrote: > > > Is there some utility function out there that can be called to sh

Re: Correct syntax for pathological re.search()

2024-10-12 Thread Peter J. Holzer via Python-list
On 2024-10-11 17:13:07 -0400, AVI GROSS via Python-list wrote: > Is there some utility function out there that can be called to show what the > regular expression you typed in will look like by the time it is ready to be > used? I assume that by "ready to be used" you mean the compiled form? No,

Re: Sanitise user input for a script

2024-08-30 Thread Peter J. Holzer via Python-list
On 2024-08-30 19:18:29 +, Simon Connah via Python-list wrote: > I need to write a script that will take some user input (supplied on a > website) and then execute a Python script on a host via SSH. I'm > curious what the best options are for protecting against malicious > input in much the smae

Re: pdb: How to use the 'break' parameter?

2024-08-21 Thread Peter J. Holzer via Python-list
On 2024-08-22 01:44:35 +, Kevin M. Wilson via Python-list wrote: > break (Old_MacDonald:23 | name[indx] == 'd', indx = 4), based on the doc spec > in python.org (https://docs.python.org/3/library/pdb.html#debugger-commands) > Cell In[1], line 20 > break (Old_MacDonald:23 | name[indx] == 'd

Re: Help needed - - running into issues with python and its tools

2024-08-04 Thread Peter J. Holzer via Python-list
On 2024-08-03 15:17:11 -0500, o1bigtenor via Python-list wrote: > One of the tools I need to be able to use is esptools - - well in the > devuan world you need to run that on either Devaun 3 or 5 - - - its just > not available on devuan 4. Couldn't you just upgrade to Devuan 5, then? > Tried in

Re: Relatively prime integers in NumPy

2024-07-12 Thread Peter J. Holzer via Python-list
On 2024-07-08 19:09:45 +, Popov, Dmitry Yu via Python-list wrote: > Does NumPy provide a simple mechanism to identify relatively prime > integers, i.e. integers which don't have a common factor other than +1 > or -1? Typing "numpy gcd" into my favourite search engine brings me to https://nump

Re: Difference method vs attribut = function

2024-06-29 Thread Peter J. Holzer via Python-list
On 2024-06-28 18:08:54 +0200, Ulrich Goebel via Python-list wrote: > a class can have methods, and it can have attributes, which can hold a > function. Both is well known, of course. > > My question: Is there any difference? > > The code snipped shows that both do what they should do. But __dict_

Tkinter and astral characters (was: Decoding bytes to text strings in Python 2)

2024-06-24 Thread Peter J. Holzer via Python-list
On 2024-06-24 01:14:22 +0100, MRAB via Python-list wrote: > Tkinter in recent versions of Python can handle astral characters, at least > back to Python 3.8, the oldest I have on my Windows PC. I just tried modifying https://docs.python.org/3/library/tkinter.html#a-hello-world-program to display "

Re: in Python: (101 102 103 201 202 203 301 302 303 401 402 403 )

2024-06-18 Thread Peter J. Holzer via Python-list
On 2024-06-14 06:10:06 -, candycanearter07 via Python-list wrote: > Phil Carmody wrote at 12:01 this Thursday (GMT): > > I'd say you can't beat the verbosity, or lack thereof of just plain > > zsh/bash: > > $ echo {1,2,3,4}0{1,2,3} > > 101 102 103 201 202 203 301 302 303 401 402 403 > >

Re: Lprint = ( Lisp-style printing ( of lists and strings (etc.) ) in Python )

2024-06-01 Thread Peter J. Holzer via Python-list
On 2024-05-30 21:47:14 -0700, HenHanna via Python-list wrote: > [('the', 36225), ('and', 17551), ('of', 16759), ('i', 16696), ('a', 15816), > ('to', 15722), ('that', 11252), ('in', 10743), ('it', 10687)] > > ((the 36225) (and 17551) (of 16759) (i 16696) (a 15816) (to 15722) (that > 11252) (in 1074

Re: From JoyceUlysses.txt -- words occurring exactly once

2024-06-01 Thread Peter J. Holzer via Python-list
On 2024-05-30 19:26:37 -0700, HenHanna via Python-list wrote: > hard to decide what to do with hyphens >and apostrophes > (I'd, he's, can't, haven't, A's and B's) Especially since the same character is used as both an apostrophe and a closing quotation mark. And w

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

2024-05-20 Thread Peter J. Holzer via Python-list
On 2024-05-20 00:26:03 +0200, Roel Schroeven via Python-list wrote: > Skip Montanaro via Python-list schreef op 20/05/2024 om 0:08: > > > Modern debian (ubuntu) and fedora block users installing using pip. > > > > Even if you're telling it to install in ~/.local? I could see not allowing > > to ru

venvs vs. package management (was: Terminal Emulator (Posting On Python-List Prohibited))

2024-05-18 Thread Peter J. Holzer via Python-list
On 2024-05-18 20:12:33 +0200, Piergiorgio Sartor via Python-list wrote: > 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

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

2024-05-18 Thread Peter J. Holzer via Python-list
On 2024-05-16 19:46:07 +0100, Gordinator via Python-list wrote: > To be fair, the problem is the fact that they use Windows (but I guess Linux > users have to deal with venvs, so we're even. I don't think Linux users have to deal with venvs any more than Windows users. Maybe even less because many

Re: Terminal Emulator

2024-05-18 Thread Peter J. Holzer via Python-list
On 2024-05-14 22:37:17 +0200, Mirko via Python-list wrote: > Am 14.05.24 um 19:44 schrieb Gordinator via Python-list: > > 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 termi

Re: Terminal Emulator

2024-05-18 Thread Peter J. Holzer via Python-list
On 2024-05-14 16:03:33 -0400, Grant Edwards via Python-list wrote: > On 2024-05-14, Alan Gauld via Python-list wrote: > > On 14/05/2024 18:44, Gordinator via Python-list wrote: > > > >> I wish to write a terminal emulator in Python. I am a fairly > >> competent Python user, and I wish to try a new

Re: Python Dialogs

2024-05-04 Thread Peter J. Holzer via Python-list
On 2024-05-02 16:34:38 +0200, Loris Bennett via Python-list wrote: > r...@zedat.fu-berlin.de (Stefan Ram) writes: > > Me (indented by 2) and the chatbot (flush left). Lines lengths > 72! > > Is there a name for this kind of indentation, i.e. the stuff you are > writing not being flush left? Ram

Re: xkcd.com/353 ( Flying with Python )

2024-03-31 Thread Peter J. Holzer via Python-list
On 2024-03-31 12:27:34 -0600, Mats Wichmann via Python-list wrote: > On 3/30/24 10:31, MRAB via Python-list wrote: > > On 2024-03-30 11:25, Skip Montanaro via Python-list wrote: > > > > > https://xkcd.com/1306/ > > > > >   what does  SIGIL   mean? > > > > > > > > I think it

Re: xkcd.com/353 ( Flying with Python )

2024-03-31 Thread Peter J. Holzer via Python-list
On 2024-03-30 17:58:08 +, Alan Gauld via Python-list wrote: > On 30/03/2024 07:04, Greg Ewing via Python-list wrote: > > On 30/03/24 7:21 pm, HenHanna wrote: > >> https://xkcd.com/1306/ > >> what does  SIGIL   mean? > > > > I think its' a Perl term, referring to the $

Re: Configuring an object via a dictionary

2024-03-17 Thread Peter J. Holzer via Python-list
On 2024-03-17 17:15:32 +1300, dn via Python-list wrote: > On 17/03/24 12:06, Peter J. Holzer via Python-list wrote: > > On 2024-03-16 08:15:19 +, Barry via Python-list wrote: > > > > On 15 Mar 2024, at 19:51, Thomas Passin via Python-list > > > > wrote: >

Re: Configuring an object via a dictionary

2024-03-16 Thread Peter J. Holzer via Python-list
On 2024-03-16 08:15:19 +, Barry via Python-list wrote: > > On 15 Mar 2024, at 19:51, Thomas Passin via Python-list > > wrote: > > I've always like writing using the "or" form and have never gotten bit > > I, on the other hand, had to fix a production problem that using “or” > introducted. >

Re: A Single Instance of an Object?

2024-03-11 Thread Peter J. Holzer via Python-list
On 2024-03-11 16:53:00 -0400, Ivan "Rambius" Ivanov via Python-list wrote: > I am refactoring some code and I would like to get rid of a global > variable. Here is the outline: ... > The global cache variable made unit testing of the lookup(key) method > clumsy, because I have to clean it after e

Re: Testing (sorry)

2024-02-20 Thread Peter J. Holzer via Python-list
On 2024-02-19 11:38:54 -0500, Thomas Passin via Python-list wrote: > On 2/19/2024 9:17 AM, Grant Edwards via Python-list wrote: > > On 2024-02-19, Thomas Passin wrote: > > > > About 24 hours later, all of my posts (and the confirmation e-mails) > > > > all showed up in a burst at the same time on

Re: Testing (sorry)

2024-02-18 Thread Peter J. Holzer via Python-list
[Replying to the list *and* Grant] On 2024-02-17 19:38:04 -0500, Grant Edwards via Python-list wrote: > Today I noticed that nothing I've posted to python-list in past 3 > weeks has shown up on the list. January 29th, AFAICS. And end of december before that. > I don't know how to troubleshoot th

Re: Using my routines as functions AND methods

2024-01-06 Thread Peter J. Holzer via Python-list
On 2024-01-03 23:17:34 -0500, Thomas Passin via Python-list wrote: > On 1/3/2024 8:00 PM, Alan Gauld via Python-list wrote: > > On 03/01/2024 22:47, Guenther Sohler via Python-list wrote: > > > Hi, > > > > > > In my cpython i have written quite some functions to modify "objects". > > > and their p

Re: How/where to store calibration values - written by program A, read by program B

2023-12-30 Thread Peter J. Holzer via Python-list
On 2023-12-29 09:01:24 -0800, Grant Edwards via Python-list wrote: > On 2023-12-28, Peter J. Holzer via Python-list wrote: > > On 2023-12-28 05:20:07 +, rbowman via Python-list wrote: > >> On Wed, 27 Dec 2023 03:53:42 -0600, Greg Walters wrote: > >> > The big

Re: How/where to store calibration values - written by program A, read by program B

2023-12-28 Thread Peter J. Holzer via Python-list
On 2023-12-28 05:20:07 +, rbowman via Python-list wrote: > On Wed, 27 Dec 2023 03:53:42 -0600, Greg Walters wrote: > > The biggest caveat is that the shared variable MUST exist before it can > > be examined or used (not surprising). > > There are a few other questions. Let's say config.py cont

Re: Python 3.12.1, Windows 11: shebang line #!/usr/bin/env python3 doesn't work any more

2023-12-23 Thread Peter J. Holzer via Python-list
On 2023-12-22 22:56:45 -0500, Thomas Passin via Python-list wrote: > In my experience one should always make sure to know what version of Python > is being used, at least if there is more than one version installed on the > computer. Even on Linux using a shebang line can be tricky, because you ar

Re: How/where to store calibration values - written by program A, read by program B

2023-12-09 Thread Peter J. Holzer via Python-list
On 2023-12-06 07:23:51 -0500, Thomas Passin via Python-list wrote: > On 12/6/2023 6:35 AM, Barry Scott via Python-list wrote: > > Personally I would not use .ini style these days as the format does not > > include type of the data. > > Neither does JSON. Well, it distinguishes between some primi

Re: Newline (NuBe Question)

2023-11-26 Thread Peter J. Holzer via Python-list
On 2023-11-25 08:32:24 -0600, Michael F. Stemper via Python-list wrote: > On 24/11/2023 21.45, avi.e.gr...@gmail.com wrote: > > Of course, for serious work, some might suggest avoiding constructs like a > > list of lists and switch to using modules and data structures [...] > > Those who would rec

Re: Code improvement question

2023-11-17 Thread Peter J. Holzer via Python-list
On 2023-11-17 07:48:41 -0500, Thomas Passin via Python-list wrote: > On 11/17/2023 6:17 AM, Peter J. Holzer via Python-list wrote: > > Oh, and Python (just like Perl) allows you to embed whitespace and > > comments into Regexps, which helps readability a lot if you have to > &g

Re: Code improvement question

2023-11-17 Thread Peter J. Holzer via Python-list
On 2023-11-16 11:34:16 +1300, Rimu Atkinson via Python-list wrote: > > > Why don't you use re.findall? > > > > > > re.findall(r'\b[0-9]{2,7}-[0-9]{2}-[0-9]{2}\b', txt) > > > > I think I can see what you did there but it won't make sense to me - or > > whoever looks at the code - in future. > > >

Re: xor operator

2023-11-15 Thread Peter J. Holzer via Python-list
On 2023-11-15 12:26:32 +0200, Dom Grigonis wrote: > > Thank you, > > > test2 = [True] * 100 + [False] * 2 > test2i = list(range(100)) > > %timeit len(set(test2i)) == 1 # 1.6 µs ± 63.6 ns per loop (mean ± std. dev. > of 7 runs, 1,000,000 loops each) > %timeit all(test2) # 386 ns

Re: xor operator

2023-11-14 Thread Peter J. Holzer via Python-list
On 2023-11-14 00:11:30 +0200, Dom Grigonis via Python-list wrote: > Benchmarks: > test1 = [False] * 100 + [True] * 2 > test2 = [True] * 100 + [False] * 2 > > TIMER.repeat([ > lambda: xor(test1), # 0.0168 > lambda: xor(test2), # 0.0172 > lambda: xor_ss(test1), # 0.1392 > la

Re: Python 3.12.0 venv not working with psycopg2

2023-10-02 Thread Peter J. Holzer via Python-list
On 2023-10-02 19:44:12 +0300, אורי via Python-list wrote: > I have an issue since about 5 months now. Python 3.12.0 venv not working > with psycopg2 on Windows. I created 2 issues on GitHub but they were > closed. I checked today with the new Python release but it's still not > working. > > https:

Re: path to python in venv

2023-09-27 Thread Peter J. Holzer via Python-list
On 2023-09-27 20:32:25 -, Jon Ribbens via Python-list wrote: > On 2023-09-27, Larry Martell wrote: > > On Wed, Sep 27, 2023 at 12:42 PM Jon Ribbens via > > Python-list wrote: > >> On 2023-09-27, Larry Martell wrote: > >> > lrwxrwxrwx 1 larrymartell larrymartell7 Sep 27 11:21 python -> >

dateutil on PyPI (was: PEP668 / pipx and "--editable" installs)

2023-09-20 Thread Peter J. Holzer via Python-list
On 2023-09-20 13:31:14 +, c.buhtz--- via Python-list wrote: > Dear Peter, > > maybe we have a missunderstanding. > > Am 20.09.2023 14:43 schrieb Peter J. Holzer via Python-list: > > > > > "dateutil" is not available from PyPi for Python 3.11 > >

Re: PEP668 / pipx and "--editable" installs

2023-09-20 Thread Peter J. Holzer via Python-list
On 2023-09-18 18:56:35 +, c.buhtz--- via Python-list wrote: > On 2023-09-18 10:16 "Peter J. Holzer via Python-list" > wrote: > > On 2023-09-15 14:15:23 +, c.buhtz--- via Python-list wrote: > > > I tried to install it via "pipx install -e .[develop]"

Re: PEP668 / pipx and "--editable" installs

2023-09-18 Thread Peter J. Holzer via Python-list
On 2023-09-15 14:15:23 +, c.buhtz--- via Python-list wrote: > I tried to install it via "pipx install -e .[develop]". It's pyproject.toml > has a bug: A missing dependency "dateutil". But "dateutil" is not available > from PyPi for Python 3.11 (the default in Debian 12). But thanks to great > D

Re: Postgresql equivalent of Python's timeit?

2023-09-17 Thread Peter J. Holzer via Python-list
On 2023-09-17 11:01:43 +0200, Albert-Jan Roskam via Python-list wrote: >On Sep 15, 2023 19:45, "Peter J. Holzer via Python-list" > wrote: > > On 2023-09-15 17:42:06 +0200, Albert-Jan Roskam via Python-list wrote: > >    This is more related to Postg

Re: `time.perf_counter_ns` always a 64-bit int?

2023-09-16 Thread Peter J. Holzer via Python-list
On 2023-09-15 21:48:37 +, rmlibre--- via Python-list wrote: > I'd like to capture the output of `time.perf_counter_ns()` as an 8-byte > timestamp. > > I'm aware that the docs provide an undefined start value for that clock. > I'm going to assume that means it can't be expected to fit within 8

Re: Postgresql equivalent of Python's timeit?

2023-09-15 Thread Peter J. Holzer via Python-list
On 2023-09-15 17:42:06 +0200, Albert-Jan Roskam via Python-list wrote: >This is more related to Postgresql than to Python, I hope this is ok. >I want to measure Postgres queries N times, much like Python timeit >(https://docs.python.org/3/library/timeit.html). I know about EXPLAIN >

Re: Passing info to function used in re.sub

2023-09-04 Thread Peter J. Holzer via Python-list
On 2023-09-03 18:10:29 +0200, Jan Erik Moström via Python-list wrote: > I want to replace some text using a regex-pattern, but before creating > replacement text I need to some file checking/copying etc. My code > right now look something like this: > > def fix_stuff(m): > # Do various thing

Re: What sort of exception when a class can't find something?

2023-08-31 Thread Peter J. Holzer via Python-list
On 2023-08-31 21:32:04 +0100, Chris Green via Python-list wrote: > What sort of exception should a class raise in __init__() when it > can't find an appropriate set of data for the parameter passed in to > the class instantiation? > > E.g. I have a database with some names and address in and have

Re: Using "textwrap" package for unwrappable languages (Japanese)

2023-08-30 Thread Peter J. Holzer via Python-list
On 2023-08-30 13:18:25 +, c.buhtz--- via Python-list wrote: > Am 30.08.2023 14:07 schrieb Peter J. Holzer via Python-list: > > another caveat: Japanese characters are usually double-width. So > > (unless your line length is 130 characters for English) you would > > want t

Re: Using "textwrap" package for unwrappable languages (Japanese)

2023-08-30 Thread Peter J. Holzer via Python-list
On 2023-08-30 11:32:02 +, c.buhtz--- via Python-list wrote: > I do use "textwrap" package to wrap longer texts passages. Works well with > English. > But the source string used is translated via gettext before it is wrapped. > > Using languages like Japanese or Chinese would IMHO result in unw

Where is the error?

2023-08-06 Thread Peter J. Holzer via Python-list
Mostly, error messages got a lot better in Python 3.10, but this one had me scratching my head for a few minutes. Consider this useless and faulty script: r = { "x": (1 + 2 + 3) "y": (4 + 5 + 6) "z": (7 + 8 + 9)

Re: Bug in io.TextIOWrapper?

2023-06-19 Thread Peter J. Holzer via Python-list
On 2023-06-20 02:15:00 +0900, Inada Naoki via Python-list wrote: > stream.flush() doesn't mean final output. > Try stream.close() After close() the value isn't available any more: Python 3.11.2 (main, Mar 13 2023, 12:18:29) [GCC 12.2.0] on linux Type "help", "copyright", "credits" or "license" fo