Re: How to test characters of a string

2022-06-09 Thread Avi Gross via Python-list
stored as names and you keep finding new variants. Yes, if your goal is to use this as a way to learn more in general about Python, clearly it may meet that goal! Contrary to what I (and some others) said earlier, it may be time to consider  regular expressions and other heavier artillery! LOL

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

2022-06-09 Thread Payton Ireland via Python-list
On Tuesday, March 8, 2022 at 12:52:29 PM UTC-6, Shaozhong SHI wrote: > The following warning kept coming up when running ogr2ogr. > > Warning 1: Missing global # gdal: DRIVER_NAME declaration in > C:\Users\AppData\Local\Programs\Python\Python36\Lib\site-packages\osgeo\g

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

2022-06-09 Thread Avi Gross via Python-list
. Consider using a search engine before posting. Throw in a few words like  "python pretty print dictionary function" and refine that if it does not get you immediate results. It is free and easy and does not waste time for so many others who already know or don't care. And conside

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
This leads to the extremely important question of what would an implementation of Python, written completely in C++, be called? C++Python CPython++ C+Python+ DPython SeaPython? SeeSeaSiPython I don't even want to think fo what sound a C# Python would make. OK, my apologies to all. Bei

Re: "CPython"

2022-06-21 Thread Avi Gross via Python-list
If we want to be humorous, RPython would obviously either be written in R, which really is not designed well for such purposes, or would be some kind of synthesis that already exists that allows you to run R and python code interchangeably on sort of shared data that I sometimes do in RSTUDIO

Re: "CPython"

2022-06-23 Thread Avi Gross via Python-list
it has it's features but have had no  opportunity to use it. Is it expected to make a faster version of Python, or enable better connections to libraries and so on?  What I mean is that if you are planning on making it pass all tests for python functionality, are you also adding unique featur

Re: "CPython"

2022-06-24 Thread Avi Gross via Python-list
with many modules now available or keep up with changes as python adds features or fixes bugs. I am curious about why something like numpy could not be integrated into what you do. Of course, if you are the only user, ... My hobbies to spend my time may not be as ambitious, but are quite a bit more

REPL with multiple function definitions

2022-06-26 Thread Rob Cliffe via Python-list
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 win32 Type "help", "copyright", "credits" or "license&qu

Re: REPL with multiple function definitions

2022-06-26 Thread Jon Ribbens via Python-list
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 win32 > Ty

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
Nati Stern has asked several questions here, often about relatively technical uses of python code that many of us have never used and still is not providing more exact info that tends to be needed before anyone can even think of diagnosing the problem. I have learned to stay away from some

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

2022-07-13 Thread Avi Gross via Python-list
=labels.to_dict() If the labels variable had a method like that, that is also a way. So be specific about what LINE or region of code and what is wrong and what you already tried or error messages you got. Avi -Original Message- From: נתי שטרן To: Neuroimaging analysis in Python ; python

ANN: distlib 0.3.5 released on PyPI

2022-07-14 Thread Vinay Sajip via Python-list
dists()``. * Fixed #172: Compute ABI correctly for Python < 3.8. * Changed the default locator configuration. * Made updates in support of PEP 643 / Metadata 2.2. * Updated launcher executables. Thanks to Michael Bikovitsky for his help with   the launcher changes. * Updated to write archive

message

2022-07-14 Thread Bart Kuijer via Python-list
, intended for Bakker-Schmalenbach's current chart of accounts in the Netherlands. I am now 84 years old, I had a stroke 4 years ago and am paralyzed on the right side, in a wheelchair and have decided to port this package to Python Can you help me with that? I think there will be a wo

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
t runtime efficiency optimizations is in vain, > because one might get different results with a different > version of Python or on a different machine. That is why I went for the less efficient code. ;-) -- Cecil Westerhof Senior Software Engineer LinkedIn: http://www.linkedin.com/in

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
Dennis Lee Bieber writes: > On Wed, 27 Jul 2022 10:45:47 +0200, Cecil Westerhof > declaimed the following: > > >>What do you mean with where the python version is from? > > Base Python.org download, ActiveState package download, Anaconda > package download, nati

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
[email protected] writes: > On 2022-07-27 at 17:48:47 +0200, > Regarding "Re: More efficient code, but slower program," > Cecil Westerhof via Python-list wrote: > >> [email protected] (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
On Fri, 5 Aug 2022 08:34:45 +0100, ojomooluwatolami675 wrote: > Hello, I’m new to learning python and I stumbled upon a question nested > loops. This is the question below. Can you please how they arrived at 9 > as the answer. Thanks > > var = 0 for i in range(3): > for j

Re: Persistent Error: Python was not found

2022-08-15 Thread Gisle Vanem via Python-list
Eryk Sun wrote: If the redirector app is run without arguments, it will open the Microsoft Store to install the latest version of the Python store app distribution. Currently that means Python 3.10. That is true with cmd. But with a shell like 4NT, I get: c:\> "%LocalAppData%\M

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
On 2022-08-20, Stefan Ram wrote: > Jon Ribbens writes: >>... or you could avoid all that faff and just do re.sub()? > > import bs4 > import re > > source = '' > > # Use Python to change the source, keeping the order of attributes. > > result

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: >> >> [email protected] 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
On 9/5/22 21:22, Meredith Montgomery wrote: I never read a book on Python. I'm looking for a good one now. I just searched the web for names such as Charles Petzold, but it looks like he never wrote a book on Python. I also searched for Peter Seibel, but he also never did. I also tri

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

2022-09-12 Thread Enerel Amgalan via Python-list
blog matching query does not exist. > > Request Method:POST > Request URL:http://127.0.0.1:8001/admin/blog/blog/add/ > Django Version:4.1.1 > Exception Type:DoesNotExist > Exception Value: > > blog matching query does not exist. > > Traceback > Environme

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
Recently I completed a project where I used PyObject_CallFunctionObjArgs extensively with the NLTK library from a program written in NASM, with no problems.  Now I am on a new project where I call the Python random library.  I use the same setup as before, but I am getting a segfault with

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

2022-09-29 Thread Robert Latest via Python-list
ssion. Not worth much since the session gets created and dumped on each request by SQA's unit of work paradigm. But the DB backend itself may be caching repeated queries. Back to Python-theory: The "Cloak" object is the only way I could think of to sneak changing data past lru_cache&#x

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 [email protected]: > 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 [email protected]: > 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
= PyObject_CallFunctionObjArgs(pAttr_randrange, value_ptr, NULL); if (p_randrange_calc == 0x0){     PyErr_Print();     return 1;} //Prepare return values long return_val = PyLong_AsLong(p_randrange_calc); return return_val; } That returns 28, which is what I get from the Python command line.  Th

Re: PyObject_CallFunctionObjArgs segfaults

2022-09-30 Thread Jen Kris via Python-list
icial docs some functions show “Return value: New reference” and others do not.  Is there any reason why I should not just INCREF on every new object, regardless of whether it’s a new reference or not, and DECREF when I am finished with it?  The answer at https://stackoverflow.com/questions/5987070

Re: PyObject_CallFunctionObjArgs segfaults

2022-09-30 Thread Jen Kris via Python-list
king at a member of a list or the value of an >> attribute.” >> >> In the official docs some functions show “Return value: New reference” and >> others do not.  Is there any reason why I should not just INCREF on every >> new object, regardless of whether it’s a

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
dn wrote: E.g. 'Scripts/pip2.exe' 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? Yes, by putting a symbolic-link at the old 'programfiler' location which points to th

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
Michael F. Stemper wrote: > How does one declare a variable in python? Sometimes it'd be nice to > be able to have declarations and any undeclared variable be flagged. To my knowledge, the closest to that is using __slots__ in class definitions. Many a time have I assigned to missp

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

2022-10-10 Thread Robert Latest via Python-list
Antoon Pardon wrote: > I would like a tool that tries to find as many syntax errors as possible > in a python file. I'm puzzled as to when such a tool would be needed. How many syntax errors can you realistically put into a single Python file before compiling it for the first time?

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
Hi! I've just downloaded and installed Python 3.10.7 (64-bit) for Windows 10 from python.org. I'm quite new but, I've already downloaded and installed Visual Studio Code as well. I have included the two paths for python under User Variables.  C:\Users\It'sMeLil'Lo

Fail 3.10.8 version installation on Windows 11 21H2

2022-10-12 Thread Kirill Ratkin via Python-list
ttempt to download URL: 'https://www.python.org/ftp/python/3.10.8/amd64/core_pdb.msi' to: 'C:\Users\Kirill\AppData\Local\Temp\{93FCA30B-7B82-4BF0-B911-5223F0E6A053}\core_AllUsers_pdb' [183C:19E4][2022-10-12T12:01:23]w343: Prompt for source of package: core_AllUsers_pdb, pa

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
command line? >> >> The reason: >> I have python program that launches a detached rm. It works pretty well >> until it is invoked by cron! I suspect that for cron we need to specify >> the full path. >> Of course I can hardcode /usr/bin/rm. But, is rm always in

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
of a shell command >>>> (linux), i.e. how do I obtain the corresponding of, for example, >>>> "type rm" in command line? >>>> >>>> The reason: >>>> I have python program that launches a detached rm. It works pretty well >>

Re: Find the path of a shell command

2022-10-12 Thread Jon Ribbens via Python-list
gt;>>> The simple question: How do I find the full path of a shell command >>>>> (linux), i.e. how do I obtain the corresponding of, for example, >>>>> "type rm" in command line? >>>>> >>>>> The reason: >>&g

Re: Find the path of a shell command

2022-10-13 Thread Jon Ribbens via Python-list
t;>>>> wrote: >>>>>> Às 05:00 de 12/10/22, Paulo da Silva escreveu: >>>>>>> Hi! >>>>>>> >>>>>>> The simple question: How do I find the full path of a shell command >>>>>>> (linux), i.

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

2022-10-14 Thread Rob Cliffe via Python-list
(f"server tag not found in {lfile}") I think there are other places I could be using it, but honestly I tend to forget it’s available. From: Python-list on behalf of Stefan Ram Date: Wednesday, October 12, 2022 at 2:22 PM To: [email protected] Subject: Re: for -- else: what was t

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

2022-10-17 Thread Robert Latest via Python-list
cussing weird keywords: Maybe we can find another use for "finally." In fact, one could argue that "while ... finally" could make just as much sense as "while ... else" (but I won't). > Of course, even if I fleshed this out and even if anyone thought it m

xml.etree and namespaces -- why?

2022-10-19 Thread Robert Latest via Python-list
Hi all, For the impatient: Below the longish text is a fully self-contained Python example that illustrates my problem. I'm struggling to understand xml.etree's handling of namespaces. I'm trying to parse an Inkscape document which uses several namespaces. From etree's docume

Re: xml.etree and namespaces -- why?

2022-10-19 Thread Jon Ribbens via Python-list
espaces/inkscape'} element = root.find('inkspace:foo', namespaces) which will work for both of the above pieces of XML. But unfortunately as far as I can see nobody's thought about doing the same for attributes rather than tags. -- https://mail.python.org/mailman/listinfo/python-list

Re: xml.etree and namespaces -- why?

2022-10-19 Thread Robert Latest via Python-list
x27;s generator to not change their prefixes. BTW, I only now thought to look at what actually is at Inkscape's namespace URI, and it turns out to be quite a nice explanation of what a namespace is and why it looks like a URL. -- https://mail.python.org/mailman/listinfo/python-list

Re: Need help with custom string formatter

2022-10-21 Thread Robert Latest via Python-list
it()? > return super().format_field( value, format_string ) Why do you prefer super().format_field() over plain format()? The doc says: "format_field() simply calls format()." So I figured I might do the same. Thanks! -- https://mail.python.org/mailman/listinfo/python-list

Need help with custom string formatter

2022-10-21 Thread Robert Latest via Python-list
return obj, key def get_value(self, key, a, kw): '''I don't understand what this method is for, it never gets called''' raise NotImplementedError fmt = MagicString(format_spec) print('\nReal output:') print(fmt.format(o=o, z=z)) # Weirdly, somewhere on the way the standard formatting kicks in, too, as # the 'Pad me!' string does get padded (which must be some postprocessing, # as the string is still unpadded when passed into get_field()) -- https://mail.python.org/mailman/listinfo/python-list

Re: Need help with custom string formatter

2022-10-21 Thread Robert Latest via Python-list
n.org/mailman/listinfo/python-list

Re: Need help with custom string formatter

2022-10-22 Thread Robert Latest via Python-list
). > > So I'd take Stefan's statement above to imply that calling format() > directly should work. Yup, makes sense. -- https://mail.python.org/mailman/listinfo/python-list

Re: Beautiful Soup - close tags more promptly?

2022-10-24 Thread Jon Ribbens via Python-list
into this: Minimal HTML file Minimal HTML file This is a minimal HTML file. Adding in the omitted , , , , and would make no difference and there's no particular reason to recommend doing so as far as I'm aware. -- https://mail.python.org/mailman/listinfo/python-list

Re: Beautiful Soup - close tags more promptly?

2022-10-24 Thread Jon Ribbens via Python-list
On 2022-10-24, Chris Angelico wrote: > On Tue, 25 Oct 2022 at 02:45, Jon Ribbens via Python-list > wrote: >> >> On 2022-10-24, Chris Angelico wrote: >> > On Mon, 24 Oct 2022 at 23:22, Peter J. Holzer wrote: >> >> Yes, I got that. What I wanted

Re: Persisting functions typed into the shell

2022-11-12 Thread Wayne Harris via Python-list
On 12/11/2022 10:01, Stefan Ram wrote: > Many readers here know interactive Python sessions with > prompts like ">>>". But a "session" could be something else. > One could imagine that when starting a new session, one > still sees all the variable

Re: In code, list.clear doesn't throw error - it's just ignored

2022-11-13 Thread Jon Ribbens via Python-list
nd print its length""" array = [1, 2, 3] array.clear print(len(array)) $ pylint -s n test.py * Module test test.py:4:0: W0104: Statement seems to have no effect (pointless-statement) -- https://mail.python.org/mailman/listinfo/python-list

Re: In code, list.clear doesn't throw error - it's just ignored

2022-11-13 Thread Jon Ribbens via Python-list
>"""Create an array and print its length""" >> >>array = [1, 2, 3] >>array.clear >>print(len(array)) >>$ pylint -s n test.py >>* Module test >>test.py:4:0: W0104: Statement seems to have no effect >> (pointless-statement) > > > Thanks, I should use linters more often. > > But why is it allowed in the first place? Because it's an expression, and you're allowed to execute expressions. -- https://mail.python.org/mailman/listinfo/python-list

Re: In code, list.clear doesn't throw error - it's just ignored

2022-11-13 Thread Jon Ribbens via Python-list
more clearly, you're allowed to evaluate > an expression and ignore the result. ... because it may have side effects, and it's not possible to determine whether it will or not in advance. -- https://mail.python.org/mailman/listinfo/python-list

Re: In code, list.clear doesn't throw error - it's just ignored

2022-11-14 Thread Jon Ribbens via Python-list
> """Create an array and print its length""" > > . Apparently, linters know this and will not create > a warning for such string literals. Not only do they know this, pylint will complain if you *don't* include that line, which is why I included it ;-) -- https://mail.python.org/mailman/listinfo/python-list

Debugging Python C extensions with GDB

2022-11-14 Thread Jen Kris via Python-list
In September 2021, Victor Stinner wrote “Debugging Python C extensions with GDB” (https://developers.redhat.com/articles/2021/09/08/debugging-python-c-extensions-gdb#getting_started_with_python_3_9).   My question is:  with Python 3.9+, can I debug into a C extension written in pure C and

Re: Debugging Python C extensions with GDB

2022-11-14 Thread Jen Kris via Python-list
Thanks for your reply.  Victor's article didn't mention ctypes extensions, so I wanted to post a question before I build from source.  Nov 14, 2022, 14:32 by [email protected]: > > >> On 14 Nov 2022, at 19:10, Jen Kris via Python-list >> wrote: >> >

Re: is mypy failing here

2022-11-24 Thread Kirill Ratkin via Python-list
b > $ cat tmp/examples/tdc.py && python tmp/examples/tdc.py && mypy > tmp/examples/tdc.py > ## > from dataclasses import dataclass > > @dataclass > class DC: > a: str > b: str > > def main(): > d

Bug report - Python 3.10 from Microsoft Store - IDLE won't start

2022-11-29 Thread Johan Gunnarsson via Python-list
1 84 Lund<https://webmail.lu.se/owa/> Telefon: +46 46 222 18 23 www.medicin.lu.se<http://www.medicin.lu.se/> -- https://mail.python.org/mailman/listinfo/python-list

pip issue

2022-11-30 Thread Gisle Vanem via Python-list
ing. I assume this is an entry for an orphaned package "MarkupSafe" since a 'pip list | grep markup' will list 'MarkupSafe 2.1.1'. -- --gv -- https://mail.python.org/mailman/listinfo/python-list

<    21   22   23   24   25   26   27   28   29   30   >