Syntax error for simple script

2017-06-26 Thread Ben S. via Python-list
Sorry for this newbie question: I installed Python v3.6.1 on win 7. Afterwards I tried to execute the following simple python script from webpage http://www.pythonforbeginners.com/code-s...me-script/: Python Code: from datetime import datetime now = datetime.now() mm = str(now.month) dd = st

"Python launcher" required to run *.py scripts on Windows?

2017-06-26 Thread Ben S. via Python-list
As I observed v3.6.1 installs (on Windows 7) in addition to the core python engine a second program "Python Launcher". As far as I read this component seems to be not necessary since it only aims to facilitate the handling with *.py scripts on Windows. When I always call Python script from Comm

Check Python version from inside script? Run Pythons script in v2 compatibility mode?

2017-07-06 Thread Ben S. via Python-list
Can I somehow check from inside a Python script if the executing Python engine is major version v2 or v3? I am thinking about a code similar to if (os.python-majorversion<3) print hello else print (hello) Additional question: Is there a way to execute a python script with v3 python engine

ANN: A new version (0.4.1) of python-gnupg has been released.

2017-07-10 Thread Vinay Sajip via Python-list
A new version of the Python module which wraps GnuPG has been released. What Changed? = This is an enhancement and bug-fix release, and all users are encouraged to upgrade. See the project website [1] for more information. Brief summary: * Updated message handling logic to no longer

RE: Users of namedtuple: do you use the _source attribute?

2017-07-17 Thread Dan Strohl via Python-list
I have never used it personally. It always looked interesting, but I never ran into a need to generate the source for it. -Original Message- From: Python-list [mailto:[email protected]] On Behalf Of Steve D'Aprano Sent: Monday, July 17, 2017 9:58 AM To: pyth

RE: Best way to assert unit test cases with many conditions

2017-07-18 Thread Dan Strohl via Python-list
Ganesh; I'm not 100% sure what you are trying to do.. so let me throw out a few things I do and see if that helps... If you are trying to run a bunch of similar tests on something, changing only (or mostly) in the parameters passed, you can use self.subTest(). Like this: Def test_this(self):

Issues with Python

2017-07-30 Thread Ode Idoko via Python-list
Hi, I am new to Python and though I have been able to download the 3.6 version on my laptop , I still have issues with the syntax. While writing a program to execute, it will display syntax error with different shades of color usually green or yellow. What can I do about this? How do I know the

Question

2017-07-31 Thread Sonja Williams via Python-list
Good Day, I have decided to learn more about programming so I picked up the book Beginning Programming by Matt Telles. After following the directions verbatim and going to the Python site to download the latest version 3, which is what the book recommended, I keep getting the following er

Code for addition

2017-08-04 Thread Ode Idoko via Python-list
Can anyone help with the python code that can add 101, 102, 103...2033 please? As I said before, I'm new to python and need assistance in this regard. Thanks for always assisting. Sent from my iPhone -- https://mail.python.org/mailman/listinfo/python-list

Re: A question on modification of a list via a function invocation

2017-08-14 Thread Larry Hudson via Python-list
On 08/14/2017 01:02 PM, Mok-Kong Shen wrote: Am 14.08.2017 um 21:53 schrieb Ned Batchelder: [snip] def test(alist): alist=[3,6,9] return def test1(alist): alist[0],alist[1],alist[2]=3,6,9 return def test2(alist): alist[0],alist[1],alist[2]=3,6,9 alist=[30,60,90] return

Re: A question on modification of a list via a function invocation

2017-08-15 Thread Larry Hudson via Python-list
On 08/14/2017 08:25 PM, Larry Hudson wrote: [snip] Here is my attempt to clarify the situation with some ascii graphics. (Well, not ascii, but utf-8 box-drawing characters — I hope they come through ok. And, of curse, it won't display properly with a proportional font.) The left side is the pr

Re: A question on modification of a list via a function invocation

2017-08-17 Thread Larry Hudson via Python-list
On 08/16/2017 03:39 PM, Chris Angelico wrote: On Thu, Aug 17, 2017 at 8:29 AM, Mok-Kong Shen wrote: I have earlier learned some other (older) programming languages. For these the formal parameters are either "by reference" or "by value". In the first case, any modification of the formal paramet

Re: A question on modification of a list via a function invocation

2017-08-17 Thread Larry Hudson via Python-list
On 08/17/2017 12:18 AM, Larry Hudson wrote: On 08/16/2017 03:39 PM, Chris Angelico wrote: On Thu, Aug 17, 2017 at 8:29 AM, Mok-Kong Shen ... Oops, I replied to Chris's post, but it was meant for the OP. I should have replied to Mok-Kong Shen's post instead. My bad. Sorry for the confusion,

BeautifulSoup doesn't work with a threaded input queue?

2017-08-27 Thread Christopher Reimer via Python-list
Greetings, I have Python 3.6 script on Windows to scrape comment history from a website. It's currently set up this way: Requestor (threads) -> list -> Parser (threads) -> queue -> CVSWriter (single thread) It takes 15 minutes to process ~11,000 comments. When I replaced the list with a qu

Re: BeautifulSoup doesn't work with a threaded input queue?

2017-08-27 Thread Christopher Reimer via Python-list
On 8/27/2017 11:54 AM, Peter Otten wrote: The documentation https://www.crummy.com/software/BeautifulSoup/bs4/doc/#making-the-soup says you can make the BeautifulSoup object from a string or file. Can you give a few more details where the queue comes into play? A small code sample would be ide

Re: BeautifulSoup doesn't work with a threaded input queue?

2017-08-27 Thread Christopher Reimer via Python-list
On 8/27/2017 1:12 PM, MRAB wrote: What do you mean by "queue (random order)"? A queue is sequential order, first-in-first-out. With 20 threads requesting 20 different pages, they're not going into the queue in sequential order (i.e., 0, 1, 2, ..., 17, 18, 19) and coming in at different time

Re: BeautifulSoup doesn't work with a threaded input queue?

2017-08-27 Thread Christopher Reimer via Python-list
On 8/27/2017 1:31 PM, Peter Otten wrote: Here's a simple example that extracts titles from generated html. It seems to work. Does it resemble what you do? Your example is similar to my code when I'm using a list for the input to the parser. You have soup_threads and write_threads, but no read_t

Re: BeautifulSoup doesn't work with a threaded input queue?

2017-08-27 Thread Christopher Reimer via Python-list
On 8/27/2017 1:50 PM, MRAB wrote: What if you don't sort the list? I ask because it sounds like you're changing 2 variables (i.e. list->queue, sorted->unsorted) at the same time, so you can't be sure that it's the queue that's the problem. If I'm using a list, I'm using a for loop to input ite

Re: BeautifulSoup doesn't work with a threaded input queue?

2017-08-27 Thread Christopher Reimer via Python-list
Ah, shoot me. I had a .join() statement on the output queue but not on in the input queue. So the threads for the input queue got terminated before BeautifulSoup could get started. I went down that same rabbit hole with CSVWriter the other day. *sigh* Thanks for everyone's help. Chris R. -- h

Is there tested Python code for parsing N-Triples?

2017-08-31 Thread David Shi via Python-list
Is there tested Python code for parsing N-Triples? Looking forward to hearing from you. Regards, David -- https://mail.python.org/mailman/listinfo/python-list

Exponential Smoothing program

2017-08-31 Thread Ode Idoko via Python-list
I am running a master degree programme and very new to programming including python. I have been given a project to write a python program on exponential smoothing of some selected stocks. The program should user the user to input alpha, display the graph of the original data and "smoothed data

rdflib, N-Triples and Pandas

2017-09-01 Thread David Shi via Python-list
How best to use rdflib to parse N-Triples files and turn them into Pandas tables? Looking forward to hearing from you. Regards, David -- https://mail.python.org/mailman/listinfo/python-list

Select data in N-Triples

2017-09-01 Thread David Shi via Python-list
in a N-Triples file, there are a lot lines like the following: "Baginton E04009817"@en .

Re: Best Practice Virtual Environment

2024-10-08 Thread Left Right via Python-list
Hi. The advice here is from a perspective of someone who does this professionally, for large, highly loaded systems. This doesn't necessarily apply to your case / not to the full extent. > Debian (or even Python3 itself) doesn't allow to pip install required > packages system wide, so I have to

Re: Correct syntax for pathological re.search()

2024-10-08 Thread Karsten Hilbert via Python-list
Am Tue, Oct 08, 2024 at 08:07:04PM +0100 schrieb MRAB via Python-list: > >unwanted_tex = '\sout{' > >if unwanted_tex not in line: do_something_with_libreoffice() > > > That should be: > > unwanted_tex = r'\sout{' Hm. Python 3.11.2 (mai

Re: Correct syntax for pathological re.search()

2024-10-08 Thread Alan Bawden via Python-list
Karsten Hilbert writes: Python 3.11.2 (main, Aug 26 2024, 07:20:54) [GCC 12.2.0] on linux Type "help", "copyright", "credits" or "license" for more information. >>> tex = '\sout{' >>> tex '\\sout{' >>> Am I missing something ?

Re: Correct syntax for pathological re.search()

2024-10-08 Thread Jon Ribbens via Python-list
On 2024-10-07, Stefan Ram wrote: > "Michael F. Stemper" wrote or quoted: >>For now, I'll use the "r" in a cargo-cult fashion, until I decide which >>syntax I prefer. (Is there any reason that one or the other is preferable?) > > I'd totally go with the r-style notation! > > It's got one bumme

Re: Correct syntax for pathological re.search()

2024-10-08 Thread Karsten Hilbert via Python-list
Am Mon, Oct 07, 2024 at 08:35:32AM -0500 schrieb Michael F. Stemper via Python-list: > I'm trying to discard lines that include the string "\sout{" (which is TeX, > for > those who are curious. I have tried: > if not re.search("\sout{", line): > if no

Signing off

2024-10-08 Thread AVI GROSS via Python-list
Just a final brief note. I am leaving the python community so don't worry that anything happened to me. I have a disagreement with the direction some people are taking with the python community that is my issue and it that probably will not bother most people. I have lots of other interests inc

RE: Correct syntax for pathological re.search()

2024-10-12 Thread AVI GROSS via Python-list
. -Original Message- From: Python-list On Behalf Of Peter J. Holzer via Python-list Sent: Saturday, October 12, 2024 7:00 AM To: [email protected] Subject: Re: Correct syntax for pathological re.search() On 2024-10-11 17:13:07 -0400, AVI GROSS via Python-list wrote: > Is there some util

Re: Correct syntax for pathological re.search()

2024-10-12 Thread Thomas Passin via Python-list
On 10/11/2024 8:37 PM, MRAB via Python-list wrote: On 2024-10-11 22:13, 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? Obviously, life is not that

Re: Correct syntax for pathological re.search()

2024-10-12 Thread Thomas Passin via Python-list
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 show what the regular expression you typed in will look like by the time it is ready to be used? I assume

Re: Correct syntax for pathological re.search()

2024-10-09 Thread Karsten Hilbert via Python-list
Am Tue, Oct 08, 2024 at 04:59:48PM -0400 schrieb Alan Bawden via Python-list: > Karsten Hilbert writes: > >Python 3.11.2 (main, Aug 26 2024, 07:20:54) [GCC 12.2.0] on linux >Type "help", "copyright", "credits" or "license

[RELEASE] Python 3.13.0 (final) released

2024-10-07 Thread Thomas Wouters via Python-list
After all the shenanigans two weeks ago – everyone discovering nasty little problems in release candidate 2 – the last week was suspiciously quiet, and therefore I can finally say: Pyth

RE: Correct syntax for pathological re.search()

2024-10-11 Thread AVI GROSS via Python-list
cases, ... -Original Message- From: Python-list On Behalf Of Gilmeh Serda via Python-list Sent: Friday, October 11, 2024 10:44 AM To: [email protected] Subject: Re: Correct syntax for pathological re.search() On Mon, 7 Oct 2024 08:35:32 -0500, Michael F. Stemper wrote: > I'

Re: Best Practice Virtual Environment

2024-10-05 Thread Thomas Passin via Python-list
On 10/5/2024 4:27 PM, Ulrich Goebel via Python-list wrote: Hi, I learned to use virtual environments where ever possible, and I learned to pip install the required packages there. That works quite nice at home. Now I come to deploy a Python script on a debian linux server, making it usable

Re: Best Practice Virtual Environment

2024-10-05 Thread Karsten Hilbert via Python-list
Am Sat, Oct 05, 2024 at 10:27:33PM +0200 schrieb Ulrich Goebel via Python-list: > Debian (or even Python3 itself) doesn't allow to pip install required > packages system wide, so I have to use virtual environments even there. But > is it right, that I have to do that for eve

Re: Best Practice Virtual Environment

2024-10-06 Thread Karsten Hilbert via Python-list
Am Sun, Oct 06, 2024 at 12:21:09AM +0200 schrieb Karsten Hilbert via Python-list: > Am Sat, Oct 05, 2024 at 10:27:33PM +0200 schrieb Ulrich Goebel via > Python-list: > > > Debian (or even Python3 itself) doesn't allow to pip install required > > packages system wide

Re: Help with Streaming and Chunk Processing for Large JSON Data (60 GB) from Kenna API

2024-10-01 Thread Greg Ewing via Python-list
On 2/10/24 10:03 am, Left Right wrote: Consider also an interesting consequence of SCSI not being able to have infinite words: this means, besides other things that fsync() is nonsense! :) If you aren't familiar with the concept: UNIX filesystem API suggests that it's possible to destage arbitrar

Best Practice Virtual Environment

2024-10-05 Thread Ulrich Goebel via Python-list
Hi, I learned to use virtual environments where ever possible, and I learned to pip install the required packages there. That works quite nice at home. Now I come to deploy a Python script on a debian linux server, making it usable for a couple of users there. Debian (or even Python3 itself) d

Re: Old matplotlib animation now fails

2024-10-16 Thread Martin Schöön via Python-list
Den 2024-10-15 skrev MRAB : > On 2024-10-15 21:16, Martin Schöön via Python-list wrote: >> Some years ago I created a Python program that reads GPS data and >> It is the second to last line that throws an error: >> >> l.set_data(x0, y0) >> >> The error m

Re: Old matplotlib animation now fails

2024-10-16 Thread Martin Schöön via Python-list
Den 2024-10-15 skrev Stefan Ram : > Martin =?UTF-8?Q?Sch=C3=B6=C3=B6n?= wrote or quoted: >>l.set_data(x0, y0) > > Well, I got to say, it's pretty rad that you're rocking Python! > That language is the bee's knees, for real. > > As for your question, here's my two cents off the cuff: > Cou

Re: Common objects for CLI commands with Typer

2024-10-16 Thread Roland Müller via Python-list
On 9/23/24 22:51, Dan Sommers via Python-list wrote: On 2024-09-23 at 19:00:10 +0100, Barry Scott wrote: On 21 Sep 2024, at 11:40, Dan Sommers via Python-list wrote: But once your code gets big the disciple of using classes helps maintenance. Code with lots of globals is problematic

Re: Old matplotlib animation now fails

2024-10-16 Thread Martin Schöön via Python-list
Den 2024-10-16 skrev Stefan Ram : > Martin =?UTF-8?Q?Sch=C3=B6=C3=B6n?= wrote or quoted: >>Me rocking Python? > >|to rock >|1. To use. To make do with, usually to great effect. >|"You don't need to make up the guest bed; we can rock the couch." > Urban Dictionary (2005) - Aaron Peckham (editor) (1

Re: Old matplotlib animation now fails

2024-10-16 Thread Chris Townley via Python-list
On 16/10/2024 22:47, rbowman wrote: On 16 Oct 2024 08:20:10 GMT, Martin Schöön wrote: Den 2024-10-15 skrev Stefan Ram : Martin =?UTF-8?Q?Sch=C3=B6=C3=B6n?= wrote or quoted: l.set_data(x0, y0) Well, I got to say, it's pretty rad that you're rocking Python! That language is the bee's k

Announcement: distlib 0.3.9 released on PyPI

2024-10-10 Thread Vinay Sajip via Python-list
Version 0.3.9 of distlib has recently been released on PyPI [1]. For newcomers, distlib is a library of packaging functionality which is intended to be usable as the basis for third-party packaging tools. The main changes in this release are as follows: * Merge #215: Preload script wrappers on

Re: Beazley's Problem

2024-10-06 Thread Antoon Pardon via Python-list
Op 23/09/2024 om 09:44 schreef Annada Behera via Python-list: The "next-level math trick" Newton-Raphson has nothing to do with functional programming. I have written solvers in purely iterative style. What is your point. Any problem solved in a functional style can also be solved

RE: Help with Streaming and Chunk Processing for Large JSON Data (60 GB) from Kenna API

2024-10-01 Thread AVI GROSS via Python-list
am results. If I only want info on records about company X between July 1 and September 15 of a particular year and only if the amount paid remains zero or is less than the amount owed, ... -Original Message- From: Python-list On Behalf Of Greg Ewing via Python-list Sent: Tuesday, October

Re: Help with Streaming and Chunk Processing for Large JSON Data (60 GB) from Kenna API

2024-10-01 Thread Dan Sommers via Python-list
On 2024-10-01 at 23:03:01 +0200, Left Right wrote: > > If I recognize the first digit, then I *can* hand that over to an > > external function to accumulate the digits that follow. > > And what is that external function going to do with this information? > The point is you didn't parse anything

Re: Help with Streaming and Chunk Processing for Large JSON Data (60 GB) from Kenna API

2024-10-01 Thread Greg Ewing via Python-list
On 2/10/24 12:26 pm, [email protected] wrote: The real problem is how the JSON is set up. If you take umpteen data structures and wrap them all in something like a list, then it may be a tad hard to stream as you may not necessarily be examining the contents till the list finishes gigabytes l

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

2024-10-03 Thread Cameron Simpson via Python-list
On 03Oct2024 22:12, Dan Ciprus (dciprus) wrote: I'd be interested too :-). Untested sketch: def make_thread(target, *a, E=None, **kw): ''' Make a new Event E and Thread T, pass `[E,*a]` as the target positional arguments. A shared preexisting Event may be

How to check whether lip movement is significant using face landmarks in dlib?

2024-10-05 Thread marc nicole via Python-list
I am trying to assess whether the lips of a person are moving too much while the mouth is closed (to conclude they are chewing). I try to assess the lip movement through landmarks (dlib) : Inspired by the mouth example ( https://github.com/mauckc/mouth-open/blob/master/detect_open_mouth.py#L17),

Re: Best Practice Virtual Environment

2024-10-05 Thread Cameron Simpson via Python-list
On 05Oct2024 22:27, Ulrich Goebel wrote: Debian (or even Python3 itself) doesn't allow to pip install required packages system wide, This is gnerally a good thing. You might modify a critical system-used package. But is it right, that I have to do that for every single user? No. Just mak

Re: Python crash together with threads

2024-10-03 Thread Left Right via Python-list
red pool. The description of _PyThreadState_GET states that callers must hold GIL. Does your code do that? It's not possible to divine that from the stack trace, but you'd probably know that. On Wed, Oct 2, 2024 at 3:29 PM Guenther Sohler via Python-list wrote: > > My Software

Capturing screenshots and recording audio in an ongoing basis, and submitting data to a RESTFul API

2024-10-22 Thread Jacob Kruger via Python-list
Hi there - know this might be a silly question, but asking anyway... As in, know these formats/data-types are probably not really possible to compress any more than they already are. Have managed to sort out capturing screenshots repeatedly, while recording audio in the background, using combi

Re: shutil.rmtree() fails when used in Fedora (rpm) "mock" environment

2024-10-25 Thread Christian Buhtz via Python-list
Thank you very much for all your responses. Am 24.10.2024 17:17 schrieb Left Right: To investigate this, I'd edit the file with the assertion and make it print the actual value found in os.lstat and func. My guess is that they are both somehow "lstat", but with different memory addresses. My

Re: shutil.rmtree() fails when used in Fedora (rpm) "mock" environment

2024-10-25 Thread Christian Buhtz via Python-list
Hello Barry, thank you for your reply and clarifying the Fedora aspects. Am 25.10.2024 00:44 schrieb Barry: What do you mean by the real file sustem? You cannot write to the /usr file system. Is that what your tests do? If so that needs changing. Asking the right questions brings up to impor

Re: shutil.rmtree() fails when used in Fedora (rpm) "mock" environment

2024-10-25 Thread Christian Buhtz via Python-list
Am 25.10.2024 09:06 schrieb Christian Buhtz via Python-list: On a "regular" system all tests are running. To clarify: "regular" does not exclude PyFakeFS. It means on my own local development machine and on the TravsCI machines (Ubuntu 22 with Python 3.9 up to 3.13) a

shutil.rmtree() fails when used in Fedora (rpm) "mock" environment

2024-10-24 Thread Christian Buhtz via Python-list
Hello, I am upstream maintainer of "Back In Time" [1] investigating an issue a distro maintainer from Fedora reported [2] to me. On one hand Fedora seems to use a tool called "mock" to build packages in a chroot environment. On the other hand the test suite of "Back In Time" does read and writ

Re: shutil.rmtree() fails when used in Fedora (rpm) "mock" environment

2024-10-24 Thread Left Right via Python-list
e, multithreaded environments it could happen... To investigate this, I'd edit the file with the assertion and make it print the actual value found in os.lstat and func. My guess is that they are both somehow "lstat", but with different memory addresses. On Thu, Oct 24, 2024 at 4:06 

Re: shutil.rmtree() fails when used in Fedora (rpm) "mock" environment

2024-10-24 Thread Dan Sommers via Python-list
On 2024-10-24 at 20:54:53 +0100, MRAB via Python-list wrote: > On 2024-10-24 20:21, Left Right wrote: > > > > > The stack is created on line 760 with os.lstat and entries are > > > > > appended > > > > > on lines 677 (os.rmdir), 679 (os.close) a

Re: shutil.rmtree() fails when used in Fedora (rpm) "mock" environment

2024-10-24 Thread Left Right via Python-list
> The stack is created on line 760 with os.lstat and entries are appended > on lines 677 (os.rmdir), 679 (os.close) and 689 (os.lstat). > > 'func' is popped off the stack on line 651 and check in the following lines. > > I can't see anywhere else where something else is put onto the stack or > an e

Re: Chardet oddity

2024-10-24 Thread Mark Bourne via Python-list
Albert-Jan Roskam wrote: Today I used chardet.detect in the repl and it returned windows-1252 (incorrect, because it later resulted in a UnicodeDecodeError). When I ran chardet as a script (which uses UniversalLineDetector) this returned MacRoman. Isn't charset.detect the correct

Re: Chardet oddity

2024-10-24 Thread Roland Mueller via Python-list
ke 23. lokak. 2024 klo 20.11 Albert-Jan Roskam via Python-list ( [email protected]) kirjoitti: >Today I used chardet.detect in the repl and it returned windows-1252 >(incorrect, because it later resulted in a UnicodeDecodeError). When I > ran >chardet as a script

Re: learning Python

2024-10-29 Thread Mats Wichmann via Python-list
On 10/27/24 16:51, o1bigtenor via Python-list wrote: Greetings There are mountains of books out there. Any suggestions for documents for a just learning how to program and starting with Python (3)? Preference to a tool where I would be learning by doing - - - that works well for me. TIA

Re: Using 'with open(...) as ...' together with configparser.ConfigParser.read

2024-10-29 Thread Jon Ribbens via Python-list
On 2024-10-29, Loris Bennett wrote: > Hi, > > With Python 3.9.18, if I do > > try: > with open(args.config_file, 'r') as config_file: > config = configparser.ConfigParser() > config.read(config_file) > print(config.sections()) > > i.e try to read the

Using 'with open(...) as ...' together with configparser.ConfigParser.read

2024-10-29 Thread Loris Bennett via Python-list
Hi, With Python 3.9.18, if I do try: with open(args.config_file, 'r') as config_file: config = configparser.ConfigParser() config.read(config_file) print(config.sections()) i.e try to read the configuration with the variable defined via 'with ... a

Re: Printing UTF-8 mail to terminal

2024-11-01 Thread Cameron Simpson via Python-list
On 01Nov2024 08:11, Loris Bennett wrote: Cameron Simpson writes: If you're using the Python email module to parse (or construct) the message as a `Message` object I'd expect that to happen automatically. I am using email.message.EmailMessage Noted. That seems like the correct approach to

Re: Printing UTF-8 mail to terminal

2024-11-01 Thread Cameron Simpson via Python-list
On 01Nov2024 10:10, Loris Bennett wrote: as expected. The non-UTF-8 text occurs when I do mail = EmailMessage() mail.set_content(body, cte="quoted-printable") ... if args.verbose: print(mail) which is presumably also correct. The question is: What conversion is necessary in order t

Re: Correct module for site customization of path

2024-11-01 Thread Tim Johnson via Python-list
On 11/1/24 08:32, [email protected] wrote: ... After the recent upgrades I had to install youtube_dl with pipx for the new python version. When I ran the script which imported youtube_dl, I got an import error as it appears the path to the module was not in sys.path I see at several op

Re: Printing UTF-8 mail to terminal

2024-11-04 Thread Loris Bennett via Python-list
Cameron Simpson writes: > On 01Nov2024 10:10, Loris Bennett wrote: >>as expected. The non-UTF-8 text occurs when I do >> >> mail = EmailMessage() >> mail.set_content(body, cte="quoted-printable") >> ... >> >> if args.verbose: >> print(mail) >> >>which is presumably also correct. >> >>T

TkInter Scrolled Listbox class?

2024-11-04 Thread Ulrich Goebel via Python-list
Hi, I would like to build a class ScrolledListbox, which can be packed somewhere in ttk.Frames. What I did is to build not really a scrolled Listbox but a Frame containing a Listbox and a Scrollbar: class FrameScrolledListbox(ttk.Frame): def __init__(self, *args, **kwargs): super().

Re: Printing UTF-8 mail to terminal

2024-11-04 Thread Loris Bennett via Python-list
Inada Naoki writes: > 2024年11月2日(土) 0:36 Loris Bennett via Python-list : > >> Left Right writes: >> >> > There's quite a lot of misuse of terminology around terminal / console >> > / shell. Please, correct me if I'm wrong, but it looks like you ar

Re: TkInter Scrolled Listbox class?

2024-11-04 Thread Alan Gauld via Python-list
On 04/11/2024 15:32, Ulrich Goebel via Python-list wrote: > I would like to build a class ScrolledListbox, I assume like the one that used to be available via the Tix module? It's a great shame that Tix is gone, it had a lot of these useful widgets, but they were all wrappers around

Re: TkInter Scrolled Listbox class?

2024-11-04 Thread Cameron Simpson via Python-list
On 04Nov2024 16:32, Ulrich Goebel wrote: I would like to build a class ScrolledListbox, which can be packed somewhere in ttk.Frames. What I did is to build not really a scrolled Listbox but a Frame containing a Listbox and a Scrollbar: That's what I would build too. class FrameScrolledListb

Re: Printing UTF-8 mail to terminal

2024-11-04 Thread Loris Bennett via Python-list
"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() mail.set_content(body, cte="quoted-printable") ... if arg

Re: TkInter Scrolled Listbox class?

2024-11-05 Thread Vishal Chandratreya via Python-list
could populate your list box and then put it inside that frame. I’ve not tested this scenario, so I’d appreciate feedback! Thanks.  On 4 Nov 2024, at 21:28, Ulrich Goebel via Python-list wrote: Hi, I would like to build a class ScrolledListbox, which can be packed

Re: Printing UTF-8 mail to terminal

2024-11-04 Thread Loris Bennett via Python-list
"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() >>> mail.set_content(body, cte="quoted-printable") >>> ... >>> >>> if args.verbose: >>> print(mail) >>> >>>

Two python issues

2024-11-05 Thread Raymond Boute via Python-list
L.S., Python seem to suffer from a few poor design decisions regarding strings and lists that affect the elegance of the language. (a) An error-prone "feature" is returning -1 if a substring is not found by "find", since -1 currently refers to the last item. An example: >>> s = 'qwertyuiop'

Re: Printing UTF-8 mail to terminal

2024-11-05 Thread Cameron Simpson via Python-list
On 04Nov2024 13:02, Loris Bennett wrote: OK, so I can do: ## if args.verbose: for k in mail.keys(): print(f"{k}: {mail.get(k)}") print('') print(mail.get_content()) ##

Re: Two python issues

2024-11-05 Thread Jason Friedman via Python-list
> > (a) An error-prone "feature" is returning -1 if a substring is not found > by "find", since -1 currently refers to the last item. An example: > > >>> s = 'qwertyuiop' > >>> s[s.find('r')] > 'r' > >>> s[s.find('p')] > 'p' > >>> s[s.find('a')] > 'p' > >>> > > If "find" is unsuccessful, an er

Re: Two python issues

2024-11-05 Thread Cameron Simpson via Python-list
On 05Nov2024 15:48, Raymond Boute wrote: Python seem to suffer from a few poor design decisions regarding strings and lists that affect the elegance of the language. (a) An error-prone "feature" is returning -1 if a substring is not found by "find", since -1 currently refers to the last item.

Specifying local dependency with Poetry

2024-11-05 Thread Loris Bennett via Python-list
Hi, I have installed a package, 'first-package, built using Poetry and installed it as root in /usr/local. The package is on sys.path so root can successfully import it. I have now developed a second package which depends on 'first-package'. I would have expected that I could specify this depend

Re: Using 'with open(...) as ...' together with configparser.ConfigParser.read

2024-10-30 Thread Jon Ribbens via Python-list
On 2024-10-30, Loris Bennett wrote: > Jon Ribbens writes: >> As per the docs you link to, the read() method only takes filename(s) >> as arguments, if you have an already-open file you want to read then >> you should use the read_file() method instead. > > As you and others have pointed out, this

Re: Using 'with open(...) as ...' together with configparser.ConfigParser.read

2024-10-30 Thread Loris Bennett via Python-list
Jon Ribbens writes: > On 2024-10-29, Loris Bennett wrote: >> Hi, >> >> With Python 3.9.18, if I do >> >> try: >> with open(args.config_file, 'r') as config_file: >> config = configparser.ConfigParser() >> config.read(config_file) >> print(config.se

Re: Using 'with open(...) as ...' together with configparser.ConfigParser.read

2024-10-30 Thread Jon Ribbens via Python-list
On 2024-10-30, Loris Bennett wrote: > Jon Ribbens writes: >> On 2024-10-30, Loris Bennett wrote: >>> Jon Ribbens writes: As per the docs you link to, the read() method only takes filename(s) as arguments, if you have an already-open file you want to read then you should use the r

Re: Using 'with open(...) as ...' together with configparser.ConfigParser.read

2024-10-30 Thread Loris Bennett via Python-list
Jon Ribbens writes: > On 2024-10-30, Loris Bennett wrote: >> Jon Ribbens writes: >>> As per the docs you link to, the read() method only takes filename(s) >>> as arguments, if you have an already-open file you want to read then >>> you should use the read_file() method instead. >> >> As you and

Re: Printing UTF-8 mail to terminal

2024-10-31 Thread Left Right via Python-list
ncoding to UTF-8 permanently: https://superuser.com/questions/269818/change-default-code-page-of-windows-console-to-utf-8 , which, I believe, will solve your problem with how the text is displayed. On Thu, Oct 31, 2024 at 5:19 PM Loris Bennett via Python-list wrote: > > Hi, > > I have a command

Re: Printing UTF-8 mail to terminal

2024-11-01 Thread Loris Bennett via Python-list
"Loris Bennett" writes: > Cameron Simpson writes: > >> On 31Oct2024 16:33, Loris Bennett wrote: >>>I have a command-line program which creates an email containing German >>>umlauts. On receiving the mail, my mail client displays the subject and >>>body correctly: >> [...] >>>So far, so good.

Re: Printing UTF-8 mail to terminal

2024-11-01 Thread Loris Bennett via Python-list
splayed. I'm not using MS Windows. I am using a Gnome terminal on Debian 12 locally and connecting via SSH to a AlmaLinux 8 server, where I start a tmux session. > On Thu, Oct 31, 2024 at 5:19 PM Loris Bennett via Python-list > wrote: >> >> Hi, >> >> I have a command-l

Re: Printing UTF-8 mail to terminal

2024-11-01 Thread Loris Bennett via Python-list
Cameron Simpson writes: > On 31Oct2024 16:33, Loris Bennett wrote: >>I have a command-line program which creates an email containing German >>umlauts. On receiving the mail, my mail client displays the subject and >>body correctly: > [...] >>So far, so good. However, when I use the --verbose o

Re: Printing UTF-8 mail to terminal

2024-11-01 Thread Dieter Maurer via Python-list
Loris Bennett wrote at 2024-11-1 10:10 +0100: > ... > mail.set_content(body, cte="quoted-printable") In the line above, you request the content to use the "cte" (= "Content-Transfer-Encoding") "quoted-printable" and consequently, the content is encoded with `quoted-printable`. Maybe, you do not n

Re: Correct module for site customization of path

2024-11-01 Thread Dieter Maurer via Python-list
> ... >After the recent upgrades I had to install youtube_dl with pipx for the >new python version. >When I ran the script which imported youtube_dl, I got an import error >as it appears the path to the module >was not in sys.path I see at several options: * install `youtoube_dl` where Pytho

Re: Printing UTF-8 mail to terminal

2024-11-01 Thread Cameron Simpson via Python-list
On 31Oct2024 21:53, [email protected] wrote: On 31/10/2024 20:50, Cameron Simpson via Python-list wrote: If you're just dealing with this directly, use the `quopri` stdlib module: https://docs.python.org/3/library/quopri.html One of the things I love about this list are these l

Re: Printing UTF-8 mail to terminal

2024-11-01 Thread Left Right via Python-list
> Windows does now. They implemented this feature over the last few years. > Indeed they took inspiration from how linux does this. > > You might find https://devblogs.microsoft.com/commandline/ has interesting > articles about this. I don't have MS Windows. My wife does, but I don't want to both

Re: Printing UTF-8 mail to terminal

2024-11-02 Thread Jon Ribbens via Python-list
On 2024-11-01, Eli the Bearded <*@eli.users.panix.com> wrote: > In comp.lang.python, Gilmeh Serda wrote: >> Python 3.12.6 (main, Sep 8 2024, 13:18:56) [GCC 14.2.1 20240805] on linux >> Type "help", "copyright", "credits" or "license" for more information. >> >>> help('modules') >> >> Please wai

Re: Printing UTF-8 mail to terminal

2024-11-02 Thread Inada Naoki via Python-list
Try PYTHONUTF8=1 envver. 2024年11月2日(土) 0:36 Loris Bennett via Python-list : > Left Right writes: > > > There's quite a lot of misuse of terminology around terminal / console > > / shell. Please, correct me if I'm wrong, but it looks like you are > > print

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

2024-10-28 Thread Lars Liedtke via Python-list
homas 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 signi

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

2024-10-25 Thread marc nicole via Python-list
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 PyAudio to collect the sound through my PC mic as follows:

Re: FileNotFoundError thrown due to file name in file, rather than file itself

2024-11-11 Thread Cameron Simpson via Python-list
On 11Nov2024 18:24, [email protected] wrote: Loris Bennett wrote at 2024-11-11 15:05 +0100: I have the following in my program: try: logging.config.fileConfig(args.config_file) config = configparser.ConfigParser() config.read(args.config_file) if args.verbos

<    46   47   48   49   50   51   52   53   54   55   >