Re: Printing Unicode strings in a list

2022-04-28 Thread Rob Cliffe via Python-list
doing that. Still, if you're feeling noble, you could start the work of making your code Python 3 compatible.😁 Best wishes Rob Cliffe -- https://mail.python.org/mailman/listinfo/python-list

Re: Python/New/Learn

2022-05-04 Thread Avi Gross via Python-list
https://wiki.python.org/moin/PythonBooks -Original Message- From: Patrick 0511 To: python-list@python.org Sent: Wed, May 4, 2022 9:36 pm Subject: Python/New/Learn Hello, I'm completely new here and don't know anything about python. Can someone tell me how best to start? So w

Re: Python/New/Learn

2022-05-04 Thread Avi Gross via Python-list
resources including videos and on-line courses. If he wants simpler books, the web pages pointed here too: https://wiki.python.org/moin/IntroductoryBooks Next time, I won't try to be helpful and brief and just be silent. -Original Message- From: Chris Angelico To: python

Re: Python/New/Learn

2022-05-04 Thread Avi Gross via Python-list
: python-list@python.org Sent: Wed, May 4, 2022 11:21 pm Subject: Re: Python/New/Learn On Thu, 5 May 2022 at 13:14, Avi Gross wrote: > > Chris, > > It was an extremely open-ended question to a forum where > most of the readers are more advanced, at least I think. > > > My libr

Re: Python/New/Learn

2022-05-05 Thread Avi Gross via Python-list
calls asking if I want to sell my house ... -Original Message- From: Schachner, Joseph To: Patrick 0511 ; python-list@python.org Sent: Thu, May 5, 2022 12:04 pm Subject: RE: Python/New/Learn Buy the book "Python 101" and do the examples.  When you're done with that buy

Re: Python/New/Learn

2022-05-06 Thread Avi Gross via Python-list
Original Message- From: 2qdxy4rzwzuui...@potatochowder.com To: python-list@python.org Sent: Fri, May 6, 2022 8:56 am Subject: Re: Python/New/Learn On 2022-05-05 at 16:51:49 -0700, Grant Edwards wrote: > On 2022-05-05, Mats Wichmann wrote: > > > Without having any data at all on it,

Re: tail

2022-05-07 Thread Avi Gross via Python-list
general purpose tool, internationalization from ASCII has created a challenge for lots of such tools. -Original Message- From: Marco Sulla To: Dennis Lee Bieber Cc: python-list@python.org Sent: Sat, May 7, 2022 9:21 am Subject: Re: tail On Sat, 7 May 2022 at 01:03, Dennis Lee Bieber wrote: > >

Re: tail

2022-05-11 Thread Avi Gross via Python-list
than how to stepwise make changes in a pipeline so reading from the beginning to end was not an issue. -Original Message- From: Marco Sulla To: Chris Angelico Cc: python-list@python.org Sent: Wed, May 11, 2022 5:27 pm Subject: Re: tail On Wed, 11 May 2022 at 22:09, Chris Angelico wrote

Re: tail

2022-05-11 Thread Avi Gross via Python-list
needed but for smaller files, KISS. -Original Message- From: Dennis Lee Bieber To: python-list@python.org Sent: Wed, May 11, 2022 6:15 pm Subject: Re: tail On Thu, 12 May 2022 06:07:18 +1000, Chris Angelico declaimed the following: >I don't understand why this wants to b

Re: .0 in name

2022-05-13 Thread Avi Gross via Python-list
rame with embedded spaces and other anomalies requiring special handling. So why you wonder where it is documented that variables cannot be what you feel like is a bit puzzling!  -Original Message- From: bryangan41 To: python-list@python.org Sent: Fri, May 13, 2022 12:47 pm Subject: .0 i

Re: .0 in name

2022-05-13 Thread Avi Gross via Python-list
... ❽ ❽ -Original Message----- From: Avi Gross via Python-list To: python-list@python.org Sent: Fri, May 13, 2022 6:02 pm Subject: Re: .0 in name Bryan, As has been pointed out, it is very common in possibly all programming languages to not allow digits at the start of many identifiers. It

Re: .0 in name

2022-05-13 Thread Avi Gross via Python-list
dundering name like __init__ ... -Original Message- From: dn To: python-list@python.org Sent: Sat, May 14, 2022 12:33 am Subject: Re: .0 in name This is not what @Avi menat by "silly variable names" but: 3D_position 2nd_floor_area 3M_PostIt_size 3rd_degree_po

Non-deterministic set ordering

2022-05-15 Thread Rob Cliffe via Python-list
#x27;x', 'y') and sometimes ('x', 'y') ('y', 'x') Can anyone explain why running identical code should result in traversing a set in a different order? Thanks Rob Cliffe -- https://mail.python.org/mailman/listinfo/python-list

Re: Non-deterministic set ordering

2022-05-15 Thread Rob Cliffe via Python-list
On 16/05/2022 04:13, Dan Stromberg wrote: On Sun, May 15, 2022 at 8:01 PM Rob Cliffe via Python-list wrote: I was shocked to discover that when repeatedly running the following program (condensed from a "real" program) under Python 3.8.3 for p in { ('x

Re: Non-deterministic set ordering

2022-05-15 Thread Rob Cliffe via Python-list
Thanks, Paul.  Question answered! Rob Cliffe On 16/05/2022 04:36, Paul Bryan wrote: This may explain it: https://stackoverflow.com/questions/27522626/hash-function-in-python-3-3-returns-different-results-between-sessions On Mon, 2022-05-16 at 04:20 +0100, Rob Cliffe via Python-list wrote

Re: Python & nmap

2022-05-18 Thread Jon Ribbens via Python-list
/Python/nmap.py", line 1, in > import nmap >File "/home/gabriele/Documenti/Python/nmap.py", line 2, in > nm.scan(hosts='192.168.205.0/24', arguments='-n -sP -PE > -PA21,23,80,3389') > NameError: name 'nm' is not defined You

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

2022-05-20 Thread Vinay Sajip via Python-list
jip/python-gnupg/releases/ [5] https://docs.red-dove.com/python-gnupg/ -- https://mail.python.org/mailman/listinfo/python-list

Re: oop issue

2022-05-23 Thread Avi Gross via Python-list
get you up to speed, but then again, we often find out someone is given a homework assignment ... -Original Message- From: Tola Oj To: python-list@python.org Sent: Mon, May 23, 2022 4:54 pm Subject: oop issue i just finished learning oop as a beginner and trying to practice with i

Re: Problems with Python

2022-05-31 Thread Howard Samuels via Python-list
erefore cannot immediately reproduce the error message.Can you help? Howard Samuels  Are You Ready for Jesus to Come? -- https://mail.python.org/mailman/listinfo/python-list

Re: How to test characters of a string

2022-06-07 Thread Avi Gross via Python-list
the original (perhaps with some normalization of case and whitespace, fine. If not will they match if one or both have something to remove as a prefix such as "02 ". And if you are comparing items where the same song is in two different numeric sequences on different disks, ...

Re: How to replace characters in a string?

2022-06-08 Thread Jon Ribbens via Python-list
x27;, 8722: '-', 8216: "'", 8217: "'", 8220: '"', 8221: '"', 64256: 'ff', 160: ' ', 64260: 'ffl', 8198: ' ', 230: 'ae', 12288: ' ', 173: '', 497: 'DZ', 498: 'Dz', 499: 'dz', 64259: 'ffi', 8230: '...', 64257: 'fi', 64262: 'st'}) If you want to go further then the Unidecode package might be helpful: https://pypi.org/project/Unidecode/ -- https://mail.python.org/mailman/listinfo/python-list

Re: How to replace characters in a string?

2022-06-08 Thread Avi Gross via Python-list
ther and how  the computer language called python, and perhaps some add-on modules, can be  used to solve each smaller need such as recognizing a pattern or replacing text. It can do quite a bit but only when the specification of the problem is exact.  -Original Message- From: Dave To: py

Re: How to test characters of a string

2022-06-09 Thread Avi Gross via Python-list
I note lots of people who come with what they consider a good programming background have to adjust to aspects of languages like python as what they know is in some ways wrong or inadequate in a new environment.  -Original Message----- From: Dave To: python-list@python.org Sent: Thu, Jun 9,

Re: Missing global # gdal DRIVER_NAME declaration in gdal_array.py

2022-06-09 Thread Payton Ireland via Python-list
dal_array.py > > > What steps to be take to resolve this issue? > > Regards, > > David Hi David, I am having this same issue. Where you ever able to resolve it? Payton -- https://mail.python.org/mailman/listinfo/python-list

Re: Function to Print a nicely formatted Dictionary or List?

2022-06-09 Thread Avi Gross via Python-list
books/courses. I think I am now going to ignore messages from you for a while. Signal to noise ratio ... -Original Message- From: Dave To: python-list@python.org Sent: Thu, Jun 9, 2022 6:43 am Subject: Function to Print a nicely formatted Dictionary or List? Hi, Before I write my own

Re: fill out bulletins

2022-06-14 Thread Avi Gross via Python-list
printed will happen to write over the same spots. As to what tools you can use, there are many to choose from. You asked on a Python list so you may want some of the Python Graphics utilities. In R, I might use ggplot which lets me set a background layer then draw objects above it at various

What's up with modern Python programmers rewriting everything in Rust?

2022-06-20 Thread jan Anja via Python-list
Dude, it's called CPython for a reason. -- https://mail.python.org/mailman/listinfo/python-list

Re: "CPython"

2022-06-20 Thread Avi Gross via Python-list
ssage- From: Paulo da Silva To: python-list@python.org Sent: Mon, Jun 20, 2022 8:53 pm Subject: Re: "CPython" Às 20:01 de 20/06/22, Paulo da Silva escreveu: > Às 18:19 de 20/06/22, Stefan Ram escreveu: >>    The same personality traits that make people react >>    to troll p

Re: "CPython"

2022-06-21 Thread Avi Gross via Python-list
who kept improving C thought the ++ concept was best removed! -Original Message- From: Greg Ewing To: python-list@python.org Sent: Tue, Jun 21, 2022 3:53 am Subject: Re: "CPython" On 21/06/22 2:56 pm, Paulo da Silva wrote: > Let's say they reimplement "reference

Re: "CPython"

2022-06-23 Thread Avi Gross via Python-list
? -----Original Message- From: David J W To: python-list@python.org Sent: Thu, Jun 23, 2022 10:29 am Subject: Re: "CPython" >> Let's say they reimplement "reference python" CPython in Rust. What is >> better? Change the "reference python" CPyth

Re: "CPython"

2022-06-24 Thread Avi Gross via Python-list
varied! LOL! -Original Message- From: David J W To: Avi Gross Cc: python-list@python.org Sent: Fri, Jun 24, 2022 11:57 am Subject: Re: "CPython" The main motivation for a Python virtual machine in Rust is to strengthen my knowledge with Rust which currently has some gnarly

REPL with multiple function definitions

2022-06-26 Thread Rob Cliffe via Python-list
ot; for more information. >>> def f(): pass ... def g(): pass   File "", line 2     def g(): pass     ^ SyntaxError: invalid syntax >>> Is there a good reason for this? Thanks Rob Cliffe -- https://mail.python.org/mailman/listinfo/python-list

Re: REPL with multiple function definitions

2022-06-26 Thread Jon Ribbens via Python-list
re a good reason for this? For some reason, the REPL can't cope with one-line blocks like that. If you put a blank line after each one-block line then it will work. -- https://mail.python.org/mailman/listinfo/python-list

Re: REPL with multiple function definitions

2022-06-28 Thread Rob Cliffe via Python-list
On 26/06/2022 23:22, Jon Ribbens via Python-list wrote: On 2022-06-26, Rob Cliffe wrote: This 2-line program def f(): pass def g(): pass runs silently (no Exception).  But: 23:07:02 c:\>python Python 3.8.3 (tags/v3.8.3:6f8c832, May 13 2020, 22:20:19) [MSC v.1925 32 bit (Intel)] on wi

Byte arrays and DLLs

2022-06-30 Thread Rob Cliffe via Python-list
Cliffe -- https://mail.python.org/mailman/listinfo/python-list

Re: Byte arrays and DLLs

2022-07-03 Thread Rob Cliffe via Python-list
That worked.  Many thanks Eryk. Rob On 30/06/2022 23:45, Eryk Sun wrote: On 6/30/22, Rob Cliffe via Python-list wrote: AKAIK it is not possible to give ctypes a bytearray object and persuade it to give you a pointer to the actual array data, suitable for passing to a DLL. You're overlo

Re: NILEARN - WHY THIS CODE THROWS AN ERROR?????

2022-07-08 Thread Avi Gross via Python-list
proceed step by step and see if any previous steps failed.  But what is possible is you got a file with .nii in middle of the name that does not end in .gz, or is not in the format needed. Good luck, אבי גרוס -Original Message----- From: MRAB To: python-list@python.org Sent: Fri, Jul 8, 2022

Re: what's the problem??????

2022-07-13 Thread Avi Gross via Python-list
ot;Difumo_names"].values()), >                        figure=(9, 7), vmax=1, vmin=-1, >                        title='Covariance')# The covariance can be found > at estimator.covariance_ > > # The covariance can be found at estimator.covariance_ >    t2=  nilearn.plot

ANN: distlib 0.3.5 released on PyPI

2022-07-14 Thread Vinay Sajip via Python-list
ajip [1] https://pypi.org/project/distlib/0.3.5/ [2] https://distlib.readthedocs.io/en/0.3.5/ [3] https://github.com/pypa/distlib/issues/new/choose -- https://mail.python.org/mailman/listinfo/python-list

message

2022-07-14 Thread Bart Kuijer via Python-list
uijer -- https://mail.python.org/mailman/listinfo/python-list

random.SystemRandom().randint() inefficient

2022-07-26 Thread Cecil Westerhof via Python-list
indication is that the second version would take about two times as much time as the first. Is there a reason for this, or should this not be happening? -- Cecil Westerhof Senior Software Engineer LinkedIn: http://www.linkedin.com/in/cecilwesterhof -- https://mail.python.org/mailman/listinfo/python

Re: random.SystemRandom().randint() inefficient

2022-07-26 Thread Cecil Westerhof via Python-list
Chris Angelico writes: > On Wed, 27 Jul 2022 at 01:06, Cecil Westerhof via Python-list > wrote: >> >> I need to get a random integer. At first I tried it with: >> from secrets import randbelow >> index = randbelow(len(to_try)) >> >> This wo

Re: random.SystemRandom().randint() inefficient

2022-07-26 Thread Cecil Westerhof via Python-list
Chris Angelico writes: > On Wed, 27 Jul 2022 at 06:06, Cecil Westerhof via Python-list > wrote: >> >> Chris Angelico writes: >> >> > On Wed, 27 Jul 2022 at 01:06, Cecil Westerhof via Python-list >> > wrote: >> >> >> >> I need

Re: random.SystemRandom().randint() inefficient

2022-07-27 Thread Cecil Westerhof via Python-list
Barry writes: >> On 26 Jul 2022, at 16:07, Cecil Westerhof via Python-list >> wrote: >> >> I need to get a random integer. At first I tried it with: >>from secrets import randbelow >>index = randbelow(len(to_try)) >> >> This works perf

Re: random.SystemRandom().randint() inefficient

2022-07-27 Thread Cecil Westerhof via Python-list
should not be used more as once. This is the code I use: # index = randbelow(len(to_try)) index = randrange(len(to_try)) found = permutation[to_try.pop(index)] -- Cecil Westerhof Senior Software Engineer LinkedIn: http://www.linkedin.com/in/cecilwesterhof -- https://mail.python.org/mailman/listinfo/python-list

Re: More efficient code, but slower program

2022-07-27 Thread Cecil Westerhof via Python-list
/cecilwesterhof -- https://mail.python.org/mailman/listinfo/python-list

Re: random.SystemRandom().randint() inefficient

2022-07-27 Thread Cecil Westerhof via Python-list
Chris Angelico writes: > On Wed, 27 Jul 2022 at 08:18, Cecil Westerhof via Python-list > wrote: >> >> Chris Angelico writes: >> >> > On Wed, 27 Jul 2022 at 06:06, Cecil Westerhof via Python-list >> > wrote: >> >> >> >> Chris A

Re: random.SystemRandom().randint() inefficient

2022-07-27 Thread Cecil Westerhof via Python-list
dbelow(len(to_try)) index = randrange(len(to_try)) found = permutation[to_try.pop(index)] -- Cecil Westerhof Senior Software Engineer LinkedIn: http://www.linkedin.com/in/cecilwesterhof -- https://mail.python.org/mailman/listinfo/python-list

Re: random.SystemRandom().randint() inefficient

2022-07-27 Thread Cecil Westerhof via Python-list
ition. I had already switched to randrange. This went to 15 minutes from 21 minutes. By removing the method lookup I could shave off another minute. So certainly noteworthy. (Should have thought about it myself.) -- Cecil Westerhof Senior Software Engineer LinkedIn: http://www.linkedin.com/in/cecilwesterhof -- https://mail.python.org/mailman/listinfo/python-list

More efficient code, but slower program

2022-07-27 Thread Cecil Westerhof via Python-list
In: http://www.linkedin.com/in/cecilwesterhof -- https://mail.python.org/mailman/listinfo/python-list

Re: random.SystemRandom().randint() inefficient

2022-07-27 Thread Cecil Westerhof via Python-list
ve OS install/extra install via OS repository > download (Debian/Ubuntu: apt install xxx, where xxx is not the native OS > Python) Just the default Debian install. -- Cecil Westerhof Senior Software Engineer LinkedIn: http://www.linkedin.com/in/cecilwesterhof -- https://mail.python.org/mailman/listinfo/python-list

Re: random.SystemRandom().randint() inefficient

2022-07-27 Thread Cecil Westerhof via Python-list
MRAB writes: > On 27/07/2022 16:43, Cecil Westerhof via Python-list wrote: >> "Michael F. Stemper" writes: >> >>> This is orthogonal to your question, but might be of some use to you: >>> >>> The combination of using len(to_try) as an

Re: More efficient code, but slower program

2022-07-27 Thread Cecil Westerhof via Python-list
2qdxy4rzwzuui...@potatochowder.com writes: > On 2022-07-27 at 17:48:47 +0200, > Regarding "Re: More efficient code, but slower program," > Cecil Westerhof via Python-list wrote: > >> r...@zedat.fu-berlin.de (Stefan Ram) writes: >> >> > Cecil W

Re: random.SystemRandom().randint() inefficient

2022-07-27 Thread Cecil Westerhof via Python-list
Roel Schroeven writes: > Cecil Westerhof via Python-list schreef op 27/07/2022 om 17:43: >> "Michael F. Stemper" writes: >> >> > This is orthogonal to your question, but might be of some use to you: >> > >> > The combination of using len(to_

Re: random.SystemRandom().randint() inefficient

2022-07-27 Thread Cecil Westerhof via Python-list
ot be a lot more expensive? Especially because I do >> not eat the whole list. >> > You won't know until you time it. A first indication is that it doubles the needed time. -- Cecil Westerhof Senior Software Engineer LinkedIn: http://www.linkedin.com/in/cecilwesterhof -- https://mail.python.org/mailman/listinfo/python-list

Re: random.SystemRandom().randint() inefficient

2022-07-27 Thread Cecil Westerhof via Python-list
is not needed anymore? -- Cecil Westerhof Senior Software Engineer LinkedIn: http://www.linkedin.com/in/cecilwesterhof -- https://mail.python.org/mailman/listinfo/python-list

Re: Fwd: timedelta object recursion bug

2022-07-28 Thread Jon Ribbens via Python-list
= timedelta(days=365) >>print(year.max) > 9 days, 23:59:59.99 >>print(year.max.min.max.resolution.max.min) > -9 days, 0:00:00 Why do you think this is a bug? -- https://mail.python.org/mailman/listinfo/python-list

Re: Trying to understand nested loops

2022-08-05 Thread Mladen Gogala via Python-list
s an answer to a homework question. You'll have to work out the details yourself. -- Mladen Gogala Database Consultant https://dbwhisperer.wordpress.com -- https://mail.python.org/mailman/listinfo/python-list

Re: Persistent Error: Python was not found

2022-08-15 Thread Gisle Vanem via Python-list
icrosoft\WindowsApps\python.exe" 4NT: (Sys) No access to the file. "C:\Users\gvane\AppData\Local\Microsoft\WindowsApps\python.exe" No matter what I do with this "App Alias" setting. What a broken and confusing design this AppX design is. -- --gv -- https://mail.python.org/mailman/listinfo/python-list

Re: UTF-8 and latin1

2022-08-17 Thread Jon Ribbens via Python-list
https://pypi.org/project/chardet/ -- https://mail.python.org/mailman/listinfo/python-list

Re: UTF-8 and latin1

2022-08-18 Thread Jon Ribbens via Python-list
are supposed to be sent using the same encoding as the page, so if you're sending the page as "latin1" then you'll see that a fair amount I should think. If you send it as "utf-8" then you'll get 100% utf-8 back. -- https://mail.python.org/mailman/listinfo/python-list

Re: UTF-8 and latin1

2022-08-18 Thread Jon Ribbens via Python-list
On 2022-08-17, Barry wrote: >> On 17 Aug 2022, at 18:30, Jon Ribbens via Python-list >> wrote: >> On 2022-08-17, Tobiah wrote: >>> I get data from various sources; client emails, spreadsheets, and >>> data from web applications. I find that I can do >

Re: UTF-8 and latin1

2022-08-18 Thread Jon Ribbens via Python-list
put: or: in the section of your HTML document. The HTML "standard" nowadays says that you are only allowed to use the "utf-8" encoding, but if you use another encoding then browsers will generally use that as both the encoding to use when reading the HTML file and the encoding to use when submitting form data. -- https://mail.python.org/mailman/listinfo/python-list

Re: UTF-8 and latin1

2022-08-18 Thread Jon Ribbens via Python-list
using. I think it's quite likely it will use UTF-32 (i.e. fixed-width 32 bits per character). > How does the browser know what sort of data it has in that text box? It's a text box, so it knows it's text. -- https://mail.python.org/mailman/listinfo/python-list

Re: Mutating an HTML file with BeautifulSoup

2022-08-20 Thread Jon Ribbens via Python-list
ng its href attribute. Fairly simple changes, but might alter > the length of the file (eg changing "http://example.com/"; into > "https://example.com/";). I'd like to do them intelligently rather than > falling back on element.sourceline and element.sourcepos, but worst > case, that's what I'll have to do (which would be fiddly). I'm tempting the Wrath of Zalgo by saying it, but ... regexp? -- https://mail.python.org/mailman/listinfo/python-list

Re: Mutating an HTML file with BeautifulSoup

2022-08-20 Thread Jon Ribbens via Python-list
o them in reverse order of line and offset I suppose) and probably resorting to regexps anyway in order to find the part of the tag you want to change ... ... or you could avoid all that faff and just do re.sub()? -- https://mail.python.org/mailman/listinfo/python-list

Re: Mutating an HTML file with BeautifulSoup

2022-08-20 Thread Jon Ribbens via Python-list
rser" ) > for a in reference.find_all( "a" ): > if a[ 'href' ]== 'http': a[ 'href' ]='https' > > print( bs4.BeautifulSoup( result, features="html.parser" )== reference ) Hmm, yes that seems like a pretty good idea. -- https://mail.python.org/mailman/listinfo/python-list

Re: Mutating an HTML file with BeautifulSoup

2022-08-21 Thread Jon Ribbens via Python-list
On 2022-08-21, Chris Angelico wrote: > On Sun, 21 Aug 2022 at 09:31, Jon Ribbens via Python-list > wrote: >> On 2022-08-20, Chris Angelico wrote: >> > On Sun, 21 Aug 2022 at 03:27, Stefan Ram wrote: >> >> 2qdxy4rzwzuui...@potatochowder.com writes: >> >

Re: Mutating an HTML file with BeautifulSoup

2022-08-22 Thread Jon Ribbens via Python-list
On 2022-08-21, Peter J. Holzer wrote: > On 2022-08-20 21:51:41 -, Jon Ribbens via Python-list wrote: >> On 2022-08-20, Stefan Ram wrote: >> > Jon Ribbens writes: >> >>... or you could avoid all that faff and just do re.sub()? > >> > source = 

Re: Mutating an HTML file with BeautifulSoup

2022-08-22 Thread Jon Ribbens via Python-list
On 2022-08-21, Chris Angelico wrote: > On Mon, 22 Aug 2022 at 05:43, Jon Ribbens via Python-list > wrote: >> On 2022-08-21, Chris Angelico wrote: >> > On Sun, 21 Aug 2022 at 09:31, Jon Ribbens via Python-list >> > wrote: >> >> On 2022-08-20, Chris Angel

Re: Mutating an HTML file with BeautifulSoup

2022-08-22 Thread Jon Ribbens via Python-list
On 2022-08-22, Peter J. Holzer wrote: > On 2022-08-22 00:45:56 -, Jon Ribbens via Python-list wrote: >> With the offset though, BeautifulSoup made an arbitrary decision to >> use ISO-8859-1 encoding and so when you chopped the bytestring at >> that offset it only worked

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

2022-08-23 Thread Vinay Sajip via Python-list
[1] https://github.com/vsajip/python-gnupg [2] https://pypi.org/project/python-gnupg/0.5.0 [3] https://github.com/vsajip/python-gnupg/issues [4] https://github.com/vsajip/python-gnupg/releases/ [5] https://docs.red-dove.com/python-gnupg/ -- https://mail.python.org/mailman/listinfo/python-list

Re: any author you find very good has written a book on Python?

2022-09-07 Thread Tim Daneliuk via Python-list
I like his writing a lot, but he also only seems to have written only for the R language. Thank you! David Beazley -- https://mail.python.org/mailman/listinfo/python-list

Re: DoesNotExist at /admin/blog/blog/add/: blog matching query does not exist

2022-09-12 Thread Enerel Amgalan via Python-list
s/fields/__init__.py", > line 1548, in pre_save return super().pre_save(model_instance, add) > File > "/var/django/liakoster.nl/blog-1/lib/python3.10/site-packages/django/db/models/fields/__init__.py", > line 1411, in pre_save return super().pre_save(model_instance, add) > File > "/var/django/liakoster.nl/blog-1/lib/python3.10/site-packages/django/db/models/fields/__init__.py", > line 905, in pre_save return getattr(model_instance, self.attname) File > "/var/django/liakoster.nl/blog-1/lib/python3.10/site-packages/django/db/models/query_utils.py", > line 178, in __get__ instance.refresh_from_db(fields=[field_name]) File > "/var/django/liakoster.nl/blog-1/lib/python3.10/site-packages/django/db/models/base.py", > line 741, in refresh_from_db db_instance = db_instance_qs.get() File > "/var/django/liakoster.nl/blog-1/lib/python3.10/site-packages/django/db/models/query.py", > line 650, in get raise self.model.DoesNotExist( > > Exception Type: DoesNotExist at /admin/blog/blog/add/ > Exception Value: blog matching query does not exist. > -- > https://mail.python.org/mailman/listinfo/python-list -- https://mail.python.org/mailman/listinfo/python-list

Re: Asynchronous execution of synchronous functions

2022-09-26 Thread Jon Ribbens via Python-list
l run time is > down to about 50 seconds. Downloading things from the network is *extremely* I/O-bound. So, as you have discovered, the GIL is going to make essentially no difference whatsoever. -- https://mail.python.org/mailman/listinfo/python-list

Implementation of an lru_cache() decorator that ignores the first argument

2022-09-28 Thread Robert Latest via Python-list
x27;''This takes a long time''' print('Expensive:', first, par) return par * 2 for i in range(10): r = expensive(i, 100) sleep(1) print(r) -- https://mail.python.org/mailman/listinfo/python-list

PyObject_CallFunctionObjArgs segfaults

2022-09-29 Thread Jen Kris via Python-list
but Py_INCREF didn’t solve it.    I’m using Python 3.8 on Ubuntu.  Thanks for any ideas on how to solve this.  Jen -- https://mail.python.org/mailman/listinfo/python-list

Re: Implementation of an lru_cache() decorator that ignores the first argument

2022-09-29 Thread Robert Latest via Python-list
27;s key lookup mechanism. Is there some other method? Just curious. -- https://mail.python.org/mailman/listinfo/python-list

Re: PyObject_CallFunctionObjArgs segfaults

2022-09-29 Thread Jen Kris via Python-list
cremented the reference to all objects in Get_LibModules, but I still get the same segfault at PyObject_CallFunctionObjArgs.  Unfortunately, reference counting is not well documented so I’m not clear what’s wrong.  Sep 29, 2022, 10:06 by pyt...@mrabarnett.plus.com: > On 2022-09-29 16:5

Re: PyObject_CallFunctionObjArgs segfaults

2022-09-29 Thread Jen Kris via Python-list
0x769be120 <_Py_NoneStruct> Thanks again. Jen Sep 29, 2022, 13:02 by python-list@python.org: > Thanks very much to @MRAB for taking time to answer.  I changed my code to > conform to your answer (as best I understand your comments on references), > but I still get the sam

Re: PyObject_CallFunctionObjArgs segfaults

2022-09-29 Thread Jen Kris via Python-list
PyLong, it'll set an error and return -1. > >> So my question is why do I get -1 as return value?  When I query p_seed calc >> : get: >> >> (gdb) p p_seed_calc >> $2 = (PyObject *) 0x769be120 <_Py_NoneStruct> >> > Exactly. It's Py_None, n

Re: PyObject_CallFunctionObjArgs segfaults

2022-09-30 Thread Jen Kris via Python-list
4_t C_API_12(PyObject * pAttr_randrange, Py_ssize_t value_1) { > PyObject * value_ptr = PyLong_FromLong(value_1); > //> value_ptr+? > if (!value_ptr) { > PyErr_Print(); > return 1; > } > > //> value_ptr+ > PyObject * p_randrange_calc = PyObject_CallFunctionObjArgs(pAttr_randrange, > value_ptr, NULL); > //> value_ptr+ p_randrange_calc+? > Py_DECREF(value_ptr); > //> p_randrange_calc+? > if (!p_randrange_calc) { > PyErr_Print(); > return 1; > } > > //Prepare return values > //> p_randrange_calc+ > return_val = PyLong_AsLong(p_randrange_calc); > Py_DECREF(p_randrange_calc); > > return return_val; > } > > -- > https://mail.python.org/mailman/listinfo/python-list > -- https://mail.python.org/mailman/listinfo/python-list

Re: PyObject_CallFunctionObjArgs segfaults

2022-09-30 Thread Jen Kris via Python-list
t * value_ptr = PyLong_FromLong(value_1); >> //> value_ptr+? >> if (!!value_ptr) { >> PyErr_Print(); >> return 1; >> } >> >> //> value_ptr+ >> PyObject * p_seed_calc = PyObject_CallFunctionObjArgs(pAttr_seed, >> value_ptr, NULL); >> //> value_ptr+ p_seed_calc+? >> Py_DECREF(value_ptr); >> //> p_seed_calc+? >> if (!p_seed_calc) { >> PyErr_Print(); >> return 1; >> } >> >> //> p_seed_calc+ >> Py_DECREF(p_seed_calc); >> return 0; >> } >> >> int64_t C_API_12(PyObject * pAttr_randrange, Py_ssize_t value_1) { >> PyObject * value_ptr = PyLong_FromLong(value_1); >> //> value_ptr+? >> if (!value_ptr) { >> PyErr_Print(); >> return 1; >> } >> >> //> value_ptr+ >> PyObject * p_randrange_calc = >> PyObject_CallFunctionObjArgs(pAttr_randrange, value_ptr, NULL); >> //> value_ptr+ p_randrange_calc+? >> Py_DECREF(value_ptr); >> //> p_randrange_calc+? >> if (!p_randrange_calc) { >> PyErr_Print(); >> return 1; >> } >> >> //Prepare return values >> //> p_randrange_calc+ >> return_val = PyLong_AsLong(p_randrange_calc); >> Py_DECREF(p_randrange_calc); >> >> return return_val; >> } >> >> -- https://mail.python.org/mailman/listinfo/python-list >> -- https://mail.python.org/mailman/listinfo/python-list

Changing 'Scripts/*.exe'

2022-10-01 Thread Gisle Vanem via Python-list
' has the path "f:\programfiler\python27\python.exe" hard-coded inside it. Is there a easy way to fix this w/o re-installing this old Python? -- --gv -- https://mail.python.org/mailman/listinfo/python-list

Re: Changing 'Scripts/*.exe'

2022-10-03 Thread Gisle Vanem via Python-list
e new 'gv' installation. I'm suspicious about sym-links. Instead for 'pip' I just did a 'py -2 get-ip.py' which seems to have fixed it. The newly generated 'f:\gv\Python27\Scripts\pip2.exe' seems to work fine; the list from 'pip2.7.exe list' is correct. -- --gv -- https://mail.python.org/mailman/listinfo/python-list

Re: for -- else: what was the motivation?

2022-10-10 Thread Jon Ribbens via Python-list
e and if the else clause was only valid syntax if the for > loop actually contained a break statement in the first place. Watch out, I suggested that here some years ago and it was derided as being an "arrogant and foolish" idea. -- https://mail.python.org/mailman/listinfo/python-list

Re: for -- else: what was the motivation?

2022-10-10 Thread Robert Latest via Python-list
https://mail.python.org/mailman/listinfo/python-list

Re: for -- else: what was the motivation?

2022-10-10 Thread Robert Latest via Python-list
conditionally executed blocks is a hundred lines, I believe your code needs refactoring. I know mine does. Either the long block should go into an extra function, or you do a "fail and bail" (just learned that phrase). -- https://mail.python.org/mailman/listinfo/python-list

Re: What to use for finding as many syntax errors as possible.

2022-10-10 Thread Robert Latest via Python-list
s, so the method should still work. Ugly as hell though. I can't think of a reason to want to find multiple syntax errors in a file. -- https://mail.python.org/mailman/listinfo/python-list

Re: for -- else: what was the motivation?

2022-10-10 Thread Robert Latest via Python-list
" block, and at the point where the unindent happens you are scratching your head again like before. Better to immediately return or break and not to use any "else" block at all. -- https://mail.python.org/mailman/listinfo/python-list

Re: What to use for finding as many syntax errors as possible.

2022-10-10 Thread Robert Latest via Python-list
elled class members until I discovered __slots__. -- https://mail.python.org/mailman/listinfo/python-list

Re: What to use for finding as many syntax errors as possible.

2022-10-10 Thread Robert Latest via Python-list
-- https://mail.python.org/mailman/listinfo/python-list

How to fix Python error, The term '.../python.exe' is not recognized as the name of a cmdlet, function, script file, or operable program, in VS Code?

2022-10-11 Thread LouisAden Capellupo via Python-list
t; It works the first way I showed with Code Runner, but the second or original way doesn't work. What if I don't want to use Code Runner? Any help in fixing this problem would be greatly appreciated. Sorry if certain things are unclear as this is my first time using Python. Thanks, LouisAden Sent from Mail for Windows -- https://mail.python.org/mailman/listinfo/python-list

Fail 3.10.8 version installation on Windows 11 21H2

2022-10-12 Thread Kirill Ratkin via Python-list
1CDD06}v3.10.8150.0\ [183C:313C][2022-10-12T12:01:32]e000: Error 0x80070005: Cache thread exited unexpectedly. end here ---- part of installer log file --- -- https://mail.python.org/mailman/listinfo/python-list

Re: Find the path of a shell command

2022-10-12 Thread Jon Ribbens via Python-list
$ which rm /usr/bin/rm $ sudo which rm /bin/rm -- https://mail.python.org/mailman/listinfo/python-list

Re: Find the path of a shell command

2022-10-12 Thread Jon Ribbens via Python-list
o which rm >> /bin/rm > > Have some major Linux distributions not done usrmerge yet? For any that > have, /bin is a symbolic link to /usr/bin I have immediate access to CentOS 7, Ubuntu 20, and Amazon Linux 2, and none of those have done that. -- https://mail.python.org/mailman/listinfo/python-list

Re: Find the path of a shell command

2022-10-12 Thread Jon Ribbens via Python-list
un without PATH being set, perhaps you just need to edit your crontab to set PATH to something sensible. Or just hard-code your program to run '/bin/rm' explicitly, which should always work (unless you're on Windows, of course!) -- https://mail.python.org/mailman/listinfo/python-list

Re: Find the path of a shell command

2022-10-12 Thread Jon Ribbens via Python-list
c link to /usr/bin > > I have immediate access to CentOS 7, Ubuntu 20, and Amazon Linux 2, > and none of those have done that. Sorry, in fact they have done that - I misread your comment as being that they had symlinked the executables not the directories. This seems quite an unwise move to me but presumably they've thought it through. -- https://mail.python.org/mailman/listinfo/python-list

Re: Find the path of a shell command

2022-10-12 Thread Jon Ribbens via Python-list
same place). > A short idea is to just check /bin/rm and /usr/bin/rm, but I prefer > searching thru PATH env. It only needs to do that once. I cannot think of any situation in which that will help you. But if for some reason you really want to do that, you can use the shutil.which() function from the standard library: >>> import shutil >>> shutil.which('rm') '/usr/bin/rm' -- https://mail.python.org/mailman/listinfo/python-list

Re: Find the path of a shell command

2022-10-12 Thread Jon Ribbens via Python-list
t; searching thru PATH env. It only needs to do that once. > > I cannot think of any situation in which that will help you. But if for > some reason you really want to do that, you can use the shutil.which() > function from the standard library: > > >>> import shutil > >>> shutil.which('rm') > '/usr/bin/rm' Actually if I'm mentioning shutil I should probably mention shutil.rmtree() as well, which does the same as 'rm -r', without needing to find or run any other executables. -- https://mail.python.org/mailman/listinfo/python-list

<    12   13   14   15   16   17   18   19   20   21   >