Re: Long running process - how to speed up?

2022-02-20 Thread Chris Angelico
On Mon, 21 Feb 2022 at 05:07, Shaozhong SHI wrote: > However, I have no idea whether this approach will be faster than > conventional approach. > > Any one has idea? Try it. Find out. The only way to know is to measure. I can't see the sleep call though. You may need to post your actual code

Re: Why does not Python accept functions with no names?

2022-02-20 Thread Chris Angelico
On Mon, 21 Feb 2022 at 02:33, Abdur-Rahmaan Janhangeer wrote: > > Greetings list. > > Out of curiosity, why doesn't Python This is often the wrong question. The question is more: Why should Python? Python doesn't do things just because there's no reason not to. ChrisA --

Re: PYT - The expressions described in the Python language reference yield only boolean values

2022-02-19 Thread Chris Angelico
On Sun, 20 Feb 2022 at 12:00, vanyp wrote: > > *I am trying to learn Python from the grammar given in the Python > language reference and I am surprised.* > The grammar is not the best way to learn the language. It'll show you a lot of unnecessary details. For technical reasons, Python's grammar

Re: Re: Long running process - how to speed up?

2022-02-19 Thread Chris Angelico
On Sat, 19 Feb 2022 at 22:59, Karsten Hilbert wrote: > > > > I have a cvs file of 932956 row and have to have time.sleep in a Python > > > script. It takes a long time to process. > > > > > > How can I speed up the processing? Can I do multi-processing? > > > > > Remove the time.sleep()? > >

Re: Long running process - how to speed up?

2022-02-19 Thread Chris Angelico
On Sat, 19 Feb 2022 at 22:30, Shaozhong SHI wrote: > > I have a cvs file of 932956 row and have to have time.sleep in a Python > script. It takes a long time to process. > > How can I speed up the processing? Can I do multi-processing? > Remove the time.sleep()? ChrisA --

Re: Pickle file and send via socket

2022-02-18 Thread Chris Angelico
On Sat, 19 Feb 2022 at 05:47, UTKARSH PANDEY wrote: > > On Wednesday, August 8, 2012 at 8:37:33 PM UTC+5:30, lipska the kat wrote: > > ... > Directly read bytes from file and send it over the socket object from client > side in while loop until all content from file is read. > Almost ten years.

Re: venv and executing other python programs

2022-02-15 Thread Chris Angelico
On Tue, 15 Feb 2022 at 21:19, Roel Schroeven wrote: > > Op 15/02/2022 om 8:21 schreef Reto: > > On Tue, Feb 15, 2022 at 06:35:18AM +0100, Mirko via Python-list wrote: > > > How to people here deal with that? > > > > Don't activate the venv for those programs then? > > The point of a venv is that

Re: C API - How to return a Dictionary as a Dictionary type

2022-02-14 Thread Chris Angelico
On Tue, 15 Feb 2022 at 12:07, Jen Kris via Python-list wrote: > > I created a dictionary with the Python C API and assigned two keys and values: > > PyObject* this_dict = PyDict_New(); > const char *key = "key1"; > char *val = "data_01"; > PyObject* val_p = PyUnicode_FromString(val); > int r =

Re: URLError:

2022-02-12 Thread Chris Angelico
On Sun, 13 Feb 2022 at 07:17, Shaozhong SHI wrote: > > The following is used in a loop to get response code for each url. > > print (urllib.request.urlopen(url).getcode()) > > However, error message says: URLError: getaddrinfo failed> > > Python 3.6.5 is being used to test whether url is live or

Re: PermissionError: [Errno 13] Permission denied: 'Abc.xlsx'

2022-02-10 Thread Chris Angelico
On Fri, 11 Feb 2022 at 07:57, Christian Gollwitzer wrote: > > Am 10.02.22 um 20:43 schrieb Chris Angelico: > > On Fri, 11 Feb 2022 at 06:41, Dennis Lee Bieber > > wrote: > >> While not tested with Excel, I /have/ encountered cases where an > >

Re: PermissionError: [Errno 13] Permission denied: 'Abc.xlsx'

2022-02-10 Thread Chris Angelico
On Fri, 11 Feb 2022 at 06:41, Dennis Lee Bieber wrote: > > On Wed, 9 Feb 2022 18:50:12 +, MRAB > declaimed the following: > > >On 2022-02-09 12:45, Christian Gollwitzer wrote: > > >> It's impossible. Excel locks the file deliberately when it is open, so > >> that you can't overwrite it from

Re: Global VS Local Subroutines

2022-02-10 Thread Chris Angelico
On Fri, 11 Feb 2022 at 03:57, Rob Cliffe via Python-list wrote: > But of course, performance is not the only consideration, as per Chris > Angelico's answer. Yep. In fact, I'd say that performance is the least significant consideration here; do what makes sense. The time difference will be

Re: How to solve the given problem?

2022-02-10 Thread Chris Angelico
On Fri, 11 Feb 2022 at 02:15, NArshad wrote: > > -ChrisA: > You don't reply if you have problems. > When I don't find any solution elsewhere then only I place in this group > You're a help vampire. Stop it. https://slash7.com/2006/12/22/vampires/ Go do some actual research instead of asking

Re: Global VS Local Subroutines

2022-02-10 Thread Chris Angelico
On Fri, 11 Feb 2022 at 02:13, BlindAnagram wrote: > > Is there any difference in performance between these two program layouts: > > def a(): > ... > def(b): > c = a(b) > > or > > def(b): > def a(): > ... > c = a(b) > > I would appreciate any insights on

Re: How to solve the given problem?

2022-02-10 Thread Chris Angelico
On Thu, 10 Feb 2022 at 18:41, NArshad wrote: > > > Assume that there is a pattern of feeding for a special fish in a day (10 > hours a day) as below: >150100303030202010 >55 > Today, the fish is fed in the second hour 60 unit

Re: Best way to check if there is internet?

2022-02-07 Thread Chris Angelico
On Tue, 8 Feb 2022 at 12:20, Ethan Furman wrote: > > On 2/7/22 4:27 PM, Greg Ewing wrote: > > On 8/02/22 8:51 am, Chris Angelico wrote: > > >> Some day, we'll have people on Mars. They won't have TCP connections - > >> at least, not unless servers sta

Re: Best way to check if there is internet?

2022-02-07 Thread Chris Angelico
On Tue, 8 Feb 2022 at 09:31, <2qdxy4rzwzuui...@potatochowder.com> wrote: > > On 2022-02-08 at 06:51:20 +1100, > Chris Angelico wrote: > > > Either way, though: would a person on Mars "have the internet"? Yes, > > but not the internet as we know it... >

Re: Best way to check if there is internet?

2022-02-07 Thread Chris Angelico
On Tue, 8 Feb 2022 at 08:30, Cameron Simpson wrote: > > On 08Feb2022 06:51, Chris Angelico wrote: > >Some day, we'll have people on Mars. They won't have TCP connections - > >at least, not unless servers start supporting connection timeouts > >measured in minutes or

Re: Best way to check if there is internet?

2022-02-07 Thread Chris Angelico
On Tue, 8 Feb 2022 at 06:41, Grant Edwards wrote: > But, as has been pointed out previously "if there is internet" is too > vague a question to have an answer. > > If all you have is proxied access to outside HTTPS servers, then I > would consider the answer to be "no", but most people would say

Re: Openning Python program

2022-02-07 Thread Chris Angelico
On Tue, 8 Feb 2022 at 06:51, Cecil Westerhof via Python-list wrote: > > Chris Angelico writes: > > >> > How difficult would it be to get people to read those lines, though? > >> > >> That does remind me about a system administrator who wanted to

Re: Openning Python program

2022-02-07 Thread Chris Angelico
On Tue, 8 Feb 2022 at 04:30, Cecil Westerhof via Python-list wrote: > > Chris Angelico writes: > > > On Tue, 8 Feb 2022 at 02:53, Grant Edwards > > wrote: > >> > >> On 2022-02-06, Dennis Lee Bieber wrote: > >> > On Sun, 6 Feb 2022 13:44:07 +0

Re: Openning Python program

2022-02-07 Thread Chris Angelico
On Tue, 8 Feb 2022 at 02:53, Grant Edwards wrote: > > On 2022-02-06, Dennis Lee Bieber wrote: > > On Sun, 6 Feb 2022 13:44:07 +0530, "createkmontalb...@gmail.com" > > declaimed the following: > > > >> I cannot open python after downloading it keeps going to modify/uninstall > >> ?? please

Re: Best way to check if there is internet?

2022-02-07 Thread Chris Angelico
at situation would probably be best described as "degraded service". (Unless one tool was straight-up misconfigured, of course.) > So What Chris Angelico wrote is propably the best way, ping e.g. Google, > do a DNS lookup and try http for Status 200. Each with its own > Errorh

Re: Best way to check if there is internet?

2022-02-07 Thread Chris Angelico
On Mon, 7 Feb 2022 at 20:18, Abdur-Rahmaan Janhangeer wrote: > > Greetings, > > Using the standard library or 3rd party libraries, what's the > best way to check if there is internet? Checking if google.com > is reachable is good but I wonder if there is a more native, > protocol-oriented > way

Re: Waht do you think about my repeated_timer class

2022-02-04 Thread Chris Angelico
On Sat, 5 Feb 2022 at 04:33, Cecil Westerhof via Python-list wrote: > > Ethan Furman writes: > > > On 2/4/22 6:28 AM, Cecil Westerhof via Python-list wrote: > > > >> It was already not a good name, but I am rewriting the class > >> completely, so now the name is a complete bumper. (No more

Re: ssl server: how to disable client cert verfication?

2022-02-03 Thread Chris Angelico
On Fri, 4 Feb 2022 at 09:37, Grant Edwards wrote: > I've looked through the ssl.Context documentation multiple times, and > haven't been able to spot any option or flag that disables client > certificate validation or allows the user to override the actual > client certificate validation process.

Re: Waht do you think about my repeated_timer class

2022-02-02 Thread Chris Angelico
On Thu, 3 Feb 2022 at 15:43, Cecil Westerhof via Python-list wrote: > > Chris Angelico writes: > > >> > (Side point: The OP's code is quite inefficient, as it creates a new > >> > thread for each reiteration, but there's nothing wrong with that if > >

Re: Waht do you think about my repeated_timer class

2022-02-02 Thread Chris Angelico
On Thu, 3 Feb 2022 at 15:28, <2qdxy4rzwzuui...@potatochowder.com> wrote: > > On 2022-02-03 at 15:07:22 +1100, > Chris Angelico wrote: > > > On Thu, 3 Feb 2022 at 14:52, <2qdxy4rzwzuui...@potatochowder.com> wrote: > > > > > > On 2022-02-03

Re: Waht do you think about my repeated_timer class

2022-02-02 Thread Chris Angelico
On Thu, 3 Feb 2022 at 14:52, <2qdxy4rzwzuui...@potatochowder.com> wrote: > > On 2022-02-03 at 12:39:43 +1100, > Cameron Simpson wrote: > > > You have: > > > > def _check_interval(self, interval): > > if not type(interval) in [int, float]: > > raise TypeError('{} is not

Re: Data unchanged when passing data to Python in multiprocessing shared memory

2022-02-02 Thread Chris Angelico
On Thu, 3 Feb 2022 at 13:32, Avi Gross via Python-list wrote: > > Jen, > > I would not be shocked at incompatibilities in the system described making it > hard to exchange anything, including text, but am not clear if there is a > limitation of four bytes in what can be shared. For me, a

Re: Waht do you think about my repeated_timer class

2022-02-02 Thread Chris Angelico
On Thu, 3 Feb 2022 at 12:24, Cecil Westerhof via Python-list wrote: > > Chris Angelico writes: > > > On Thu, 3 Feb 2022 at 09:33, Barry wrote: > > (Side point: The OP's code is quite inefficient, as it creates a new > > thread for each reiteration

Re: Waht do you think about my repeated_timer class

2022-02-02 Thread Chris Angelico
On Thu, 3 Feb 2022 at 09:33, Barry wrote: > > > > > On 2 Feb 2022, at 21:12, Marco Sulla wrote: > > > > You could add a __del__ that calls stop :) > > Didn’t python3 make this non deterministic when del is called? > > I thought the recommendation is to not rely on __del__ in python3 code. >

Re: Segfault after deepcopy in a C extension

2022-01-31 Thread Chris Angelico
On Tue, 1 Feb 2022 at 08:54, Marco Sulla wrote: > PyObject* d = PyDict_New(); > args = PyTuple_New(2); > PyTuple_SET_ITEM(args, 0, d); > PyTuple_SET_ITEM(args, 1, memo); > Py_DECREF(d); > https://docs.python.org/3/c-api/tuple.html#c.PyTuple_SET_ITEM SET_ITEM steals a

Re: What to write or search on github to get the code for what is written below:

2022-01-31 Thread Chris Angelico
On Tue, 1 Feb 2022 at 02:38, NArshad wrote: > > What about CGI? > Do you know any Library Management System based on CGI just like the one on > Django? > Have you done any research, or are you just picking up a new acronym to see if you can suck some more volunteer time out of this list?

Re: Puzzling behaviour of Py_IncRef

2022-01-26 Thread Chris Angelico
On Wed, 26 Jan 2022 at 19:04, Tony Flury via Python-list wrote: > > So according to that I should increment twice if and only if the calling > code is using the result - which you can't tell in the C code - which is > very odd behaviour. No, the return value from your C function will *always*

Re: Pandas or Numpy

2022-01-23 Thread Chris Angelico
On Mon, 24 Jan 2022 at 04:10, Tobiah wrote: > > I know very little about either. I need to handle score input files > for Csound. Each line is a list of floating point values where each > column has a particular meaning to the program. > > I need to compose large (hundreds, thousands, maybe

Re: What to write or search on github to get the code for what is written below:

2022-01-22 Thread Chris Angelico
On Sun, 23 Jan 2022 at 09:15, Dennis Lee Bieber wrote: > A web > application has every action as a distinct connection and needs identifying > tokens [cookies] to let the logic know what was done previously > Usually. Fortunately, we have SOME features that can make life easier, but in general,

Re: What to write or search on github to get the code for what is written below:

2022-01-22 Thread Chris Angelico
On Sun, 23 Jan 2022 at 07:47, Dennis Lee Bieber wrote: > If you are doing a web application, how are you going to host it? Who > is responsible for managing the web server? Domain name? Firewalls? > Certificates if you need HTTPS rather than plain insecure HTTP. > > I have a

Re: Puzzling behaviour of Py_IncRef

2022-01-20 Thread Chris Angelico
On Fri, 21 Jan 2022 at 10:10, Greg Ewing wrote: > > On 20/01/22 12:09 am, Chris Angelico wrote: > > At this point, the refcount has indeed been increased. > > > >> return self; > >> } > > > > And then you say "my return

Re: Puzzling behaviour of Py_IncRef

2022-01-19 Thread Chris Angelico
On Thu, Jan 20, 2022 at 1:22 AM Tony Flury wrote: > > > On 19/01/2022 11:09, Chris Angelico wrote: > > On Wed, Jan 19, 2022 at 10:00 PM Tony Flury via Python-list > > wrote: > >> Extension function : > >> > >> stat

Re: Puzzling behaviour of Py_IncRef

2022-01-19 Thread Chris Angelico
On Wed, Jan 19, 2022 at 10:00 PM Tony Flury via Python-list wrote: > Extension function : > > static PyObject *_Node_test_ref_count(PyObject *self) > { > printf("\nIncrementing ref count for self - just for the hell > of it\n"); > printf("\n before self has a ref

Re: What to write or search on github to get the code for what is written below:

2022-01-17 Thread Chris Angelico
On Tue, Jan 18, 2022 at 7:44 AM Dennis Lee Bieber wrote: > Heroku-Specific note: a recent web-page I encountered searching for > information for a different question indicates that Heroku does not support > SQLite3 and, by extension, ANY file-based dynamic data storage (so, no > Excel files

Re: What to write or search on github to get the code for what is written below:

2022-01-17 Thread Chris Angelico
On Tue, Jan 18, 2022 at 2:46 AM NArshad wrote: > > Avi Gross: > > -“They just were hoping someone would post complete code and they could then > move on without learning anything.” > > This is due to the time factor Then pay someone to write it. There are plenty of contractors out there. You

Re: About Python Compressed Archive or Binaries

2022-01-17 Thread Chris Angelico
On Tue, Jan 18, 2022 at 2:47 AM Chris Angelico wrote: > > On Tue, Jan 18, 2022 at 2:42 AM Sina Mobasheri > wrote: > > > > Java offers download JDK as Compressed Archive or NodeJS offers download > > Node as Binaries both give us a compressed file for Linux and wi

Re: About Python Compressed Archive or Binaries

2022-01-17 Thread Chris Angelico
On Tue, Jan 18, 2022 at 2:42 AM Sina Mobasheri wrote: > > Java offers download JDK as Compressed Archive or NodeJS offers download Node > as Binaries both give us a compressed file for Linux and windows that we can > just unzipped it and put in a custom directory and set some environment >

Re: What to write or search on github to get the code for what is written below:

2022-01-13 Thread Chris Angelico
On Fri, Jan 14, 2022 at 7:56 AM Dennis Lee Bieber wrote: > > On Thu, 13 Jan 2022 15:22:50 -0500, Dennis Lee Bieber > declaimed the following: > > Talking to myself in public again... Bad habit... Not as bad as singing choruses in public, which - or so I'm told, by a mad girl in opera -

Re: Scope confusion in Python REPL

2022-01-13 Thread Chris Angelico
On Thu, Jan 13, 2022 at 9:43 PM Anssi Saari wrote: > > > I ran into what seems odd scoping to me when playing with some matching > examples for 3.10. > > I kinda thought that if I do from foo import * and from bar import * in > the Python REPL, I'd get everything from foo and bar in the main >

Re: sharing data across Examples docstrings

2022-01-11 Thread Chris Angelico
On Wed, Jan 12, 2022 at 9:11 AM Sebastian Luque wrote: > > Hello, > > I am searching for a mechanism for sharing data across Examples sections > in docstrings within a class. For instance: This seems like trying to cram too much information into the docstring, but oh well... do what you will.

Re: Why operations between dict views return a set and not a frozenset?

2022-01-11 Thread Chris Angelico
On Wed, Jan 12, 2022 at 5:49 AM Marco Sulla wrote: > > Ok... so I suppose, since you're inviting me to use dis and look at the > bytecode, that are you talking about constants in assembly, so const in C? > Sorry for the confusion, I'm not so skilled in C and I know nearly nothing > about

Re: symlinks with python3 http.server.CGIHTTPRequestHandler

2022-01-11 Thread Chris Angelico
On Tue, Jan 11, 2022 at 6:17 AM Nat Taylor wrote: > > Is it possible to get http.server.CGIHTTPRequestHandler to run a symlink-ed > script? > > In the example below, GET /cgi-bin/test.py results in a 404 because it is a > symlink. > > % mkdir -p test/cgi-bin > % cd test > % vi test.py > % chmod

Re: Why operations between dict views return a set and not a frozenset?

2022-01-10 Thread Chris Angelico
On Tue, Jan 11, 2022 at 10:26 AM Marco Sulla wrote: > > On Wed, 5 Jan 2022 at 23:02, Chris Angelico wrote: > > > > On Thu, Jan 6, 2022 at 8:01 AM Marco Sulla > > wrote: > > > > > > On Wed, 5 Jan 2022 at 14:16, Chris Angelico wrote: > > > &g

Re: What to write or search on github to get the code for what is written below:

2022-01-07 Thread Chris Angelico
On Sat, Jan 8, 2022 at 6:50 AM NArshad wrote: > - All functions mentioned above are to be deployed on the website > pythonhow.com so make according to > https://pythonhow.com/python-tutorial/flask/web-development-with-python-and-flask/ > > - Do you know any other websites to deploy a python web

Re: AttributeError: 'NoneType' object has no attribute 'get'

2022-01-06 Thread Chris Angelico
On Fri, Jan 7, 2022 at 8:47 AM <2qdxy4rzwzuui...@potatochowder.com> wrote: > > On 2022-01-06 at 14:21:48 -0700, > Mats Wichmann wrote: > > > And at a more meta level: many functions in the Python world return > > None as an indication that the operation did not succeed. It's useful > > because

Re: Why operations between dict views return a set and not a frozenset?

2022-01-05 Thread Chris Angelico
On Thu, Jan 6, 2022 at 8:01 AM Marco Sulla wrote: > > On Wed, 5 Jan 2022 at 14:16, Chris Angelico wrote: > > That's an entirely invisible optimization, but it's more than just > > "frozenset is faster than set". It's that a frozenset or tuple can be > > store

Re: Why operations between dict views return a set and not a frozenset?

2022-01-05 Thread Chris Angelico
On Thu, Jan 6, 2022 at 12:05 AM Marco Sulla wrote: > > On Wed, 5 Jan 2022 at 00:54, Chris Angelico wrote: > > That's because a tuple is the correct data type when returning two > > distinct items. It's not a list that has two elements in it; it's a > > tuple of (k

Re: Why operations between dict views return a set and not a frozenset?

2022-01-04 Thread Chris Angelico
On Wed, Jan 5, 2022 at 7:04 AM Marco Sulla wrote: > > On Tue, 4 Jan 2022 at 19:38, Chris Angelico wrote: > > [...] should the keys view be considered > > frozen or not? Remember the set of keys can change (when the > > underlying dict changes). > > W

Re: Why operations between dict views return a set and not a frozenset?

2022-01-04 Thread Chris Angelico
On Wed, Jan 5, 2022 at 5:29 AM Marco Sulla wrote: > > $ python > Python 3.10.0 (heads/3.10-dirty:f6e8b80d20, Nov 18 2021, 19:16:18) > [GCC 10.1.1 20200718] on linux > Type "help", "copyright", "credits" or "license" for more information. > >>> a = {1:2} > >>> c = {1:2, 3:4} > >>> c.keys() -

Re: KeyError: 'payload' while running core.py

2022-01-02 Thread Chris Angelico
On Mon, Jan 3, 2022 at 1:46 PM Đông Vũ wrote: > > That is error, please help me fix it. > > Traceback (most recent call last): > File > "C:\Users\vuduc\AppData\Local\Programs\Python\Python39\lib\site-packages\frida\core.py", > line 450, in _on_message > callback(message, data) > File

Re: Who wrote Py_UNREACHABLE?

2022-01-02 Thread Chris Angelico
On Mon, Jan 3, 2022 at 3:19 AM Marco Sulla wrote: > > #if defined(RANDALL_WAS_HERE) > # define Py_UNREACHABLE() \ > Py_FatalError( \ > "If you're seeing this, the code is in what I thought was\n" \ > "an unreachable state.\n\n" \ > "I could give you advice for what to

Re: builtins.TypeError: catching classes that do not inherit from BaseException is not allowed

2021-12-30 Thread Chris Angelico
On Fri, Dec 31, 2021 at 9:42 AM hongy...@gmail.com wrote: > > (Also, is this REALLY an optimization? Exception handling isn't the > > fastest. Yes, it avoids some measure of recursion depth, but it looks > > like a pretty inefficient way to do things. Python is not Lisp, and > > there are very

Re: builtins.TypeError: catching classes that do not inherit from BaseException is not allowed

2021-12-30 Thread Chris Angelico
On Fri, Dec 31, 2021 at 9:42 AM hongy...@gmail.com wrote: > > On Thursday, December 30, 2021 at 11:24:20 PM UTC+8, Chris Angelico wrote: > > On Fri, Dec 31, 2021 at 2:03 AM hongy...@gmail.com > > wrote: > > > See here [1] for the related discussion. &

Re: builtins.TypeError: catching classes that do not inherit from BaseException is not allowed

2021-12-30 Thread Chris Angelico
On Fri, Dec 31, 2021 at 2:03 AM hongy...@gmail.com wrote: > See here [1] for the related discussion. > > [1] > https://discuss.python.org/t/typeerror-catching-classes-that-do-not-inherit-from-baseexception-is-not-allowed/12800 Why did you post in two places at once? Did you need more people to

Re: builtins.TypeError: catching classes that do not inherit from BaseException is not allowed

2021-12-30 Thread Chris Angelico
On Fri, Dec 31, 2021 at 2:00 AM hongy...@gmail.com wrote: > > I try to compute the factorial of a large number with tail-recursion > optimization decorator in Python3. The following code snippet is converted > from the code snippet given here [1] by the following steps: > > $ pyenv shell

Re: recover pickled data: pickle data was truncated

2021-12-29 Thread Chris Angelico
On Thu, Dec 30, 2021 at 4:32 AM iMath wrote: > > > You have lost the data in that case. > > But I found the size of the file of the shelve data didn't change much, so I > guess the data are still in it , I just wonder any way to recover my data. Unless two conflicting versions got interleaved,

Re: What's the public API alternative to _PyObject_GC_IS_TRACKED()?

2021-12-29 Thread Chris Angelico
On Wed, Dec 29, 2021 at 8:07 PM Dieter Maurer wrote: > > Marco Sulla wrote at 2021-12-29 09:29 +0100: > >On second thought, I think I'll do this for the pure py version. But I > >will definitely not do this for the C extension > > Are you sure you need to implement your type in C at all? > > I

Re: PIP Certificate problem

2021-12-27 Thread Chris Angelico
On Tue, Dec 28, 2021 at 8:00 AM Aniket wrote: > >I have reinstalled python, and repaired but no help at all. My version of >Python is 3.10.1 > What does "pip --version" tell you? ChrisA -- https://mail.python.org/mailman/listinfo/python-list

Re: 'array.array' object has no attribute 'tostring' which 3 got it fixed?

2021-12-21 Thread Chris Angelico
On Tue, Dec 21, 2021 at 9:56 PM '2+ wrote: > > hi ;) > > got popos installed on my raspberry pi4 and it is currently running python > 3.9.7 > > i get this error when running my script: > > 'array.array' object has no attribute 'tostring' > > this bug seems to be pretty old .. how long should i be

Re: Call julia from Python: which package?

2021-12-17 Thread Chris Angelico
On Sat, Dec 18, 2021 at 10:01 AM Oscar Benjamin wrote: > > On Fri, 17 Dec 2021 at 22:40, Chris Angelico wrote: > > > > On Sat, Dec 18, 2021 at 9:24 AM Oscar Benjamin > > wrote: > > > When I timed the result in Julia and in Python I found that the Julia > >

Re: Call julia from Python: which package?

2021-12-17 Thread Chris Angelico
On Sat, Dec 18, 2021 at 9:24 AM Oscar Benjamin wrote: > When I timed the result in Julia and in Python I found that the Julia > code was slower than the Python code. Of course I don't know how to > optimise Julia code so I asked one of my colleagues who does (and who > likes to proselytise about

Re: A problem with itertools.groupby

2021-12-17 Thread Chris Angelico
On Sat, Dec 18, 2021 at 2:32 AM ast wrote: > > Python 3.9.9 > > Hello > > I have some troubles with groupby from itertools > > from itertools import groupby > > li = [grp for k, grp in groupby("aahfffddnnb")] > list(li[0]) > > [] > > list(li[1]) > > [] > > It seems empty ... I don't

Re: ast.parse, ast.dump, but with comment preservation?

2021-12-15 Thread Chris Angelico
On Thu, Dec 16, 2021 at 2:47 PM samue...@gmail.com wrote: > > I wrote a little open-source tool to expose internal constructs in OpenAPI. > Along the way, I added related functionality to: > - Generate/update a function prototype to/from a class > - JSON schema > - Automatically add type

Re: problem reading a CSV file

2021-12-13 Thread Chris Angelico
On Tue, Dec 14, 2021 at 12:05 AM Larry Warner wrote: > > Win 10, Chrome, Python 3.10.1 > New at python > error on open statement > > Probably simple error but I do not see it. > > The program is a python example with the file name being changed. I want > to experiment with changing the literal

Re: Isn't TypeError built in?

2021-12-12 Thread Chris Angelico
On Mon, Dec 13, 2021 at 12:31 PM Mike Dewhirst via Python-list wrote: > > Obviously something is wrong elsewhere but I'm not sure where to look. > Ubuntu 20.04 with plenty of RAM. > > def __del__(self): > try: > for context_obj in self._context_refs: >

Re: Return

2021-12-07 Thread Chris Angelico
On Wed, Dec 8, 2021 at 9:04 AM dn via Python-list wrote: > > plus Python, unlike some other languages, allows us to return multiple > values, either as a collection or as an implied-tuple: > > def function_list(): > a_list = [ i for i in range( 9 ) ] > return a_list > > def

Re: HTML extraction

2021-12-07 Thread Chris Angelico
On Wed, Dec 8, 2021 at 7:55 AM Roland Mueller wrote: > > Hello, > > ti 7. jouluk. 2021 klo 20.08 Chris Angelico (ros...@gmail.com) kirjoitti: >> >> On Wed, Dec 8, 2021 at 4:55 AM Julius Hamilton >> wrote: >> > >> > Hey, >> > >> >

Re: For a hierarchical project, the EXE file generated by "pyinstaller" does not start.

2021-12-07 Thread Chris Angelico
On Wed, Dec 8, 2021 at 4:49 AM Mohsen Owzar wrote: > *** > GPIOContrl.py > *** > class GPIOControl: > def my_print(self, args): > if print_allowed == 1: > print(args) >

Re: Urllib.request vs. Requests.get

2021-12-07 Thread Chris Angelico
On Wed, Dec 8, 2021 at 4:51 AM Julius Hamilton wrote: > > Hey, > > I am currently working on a simple program which scrapes text from webpages > via a URL, then segments it (with Spacy). > > I’m trying to refine my program to use just the right tools for the job, > for each of the steps. > >

Re: HTML extraction

2021-12-07 Thread Chris Angelico
On Wed, Dec 8, 2021 at 4:55 AM Julius Hamilton wrote: > > Hey, > > Could anyone please comment on the purest way simply to strip HTML tags > from the internal text they surround? > > I know Beautiful Soup is a convenient tool, but I’m interested to know what > the most minimal way to do it would

Re: Python child process in while True loop blocks parent

2021-12-06 Thread Chris Angelico
On Tue, Dec 7, 2021 at 4:10 AM Jen Kris via Python-list wrote: > > I can't find any support for your comment that "Fork creates a new > process and therefore also a new thread." From the Linux man pages > https://www.man7.org/linux/man-pages/man2/fork.2.html, "The child process is > created

A decade or so of Python programming, and I've never thought to "for-elif"

2021-11-29 Thread Chris Angelico
for ns in namespaces: if name in ns: print("Found!") break elif name.isupper(): print("All-caps name that wasn't found") This actually doesn't work. I have been programming in Python for well over a decade, and never before been in a situation where this would be useful.

Re: frozenset can be altered by |=

2021-11-29 Thread Chris Angelico
On Tue, Nov 30, 2021 at 12:41 PM Richard Damon wrote: > > On 11/29/21 5:01 PM, Chris Angelico wrote: > > On Tue, Nov 30, 2021 at 8:55 AM Marco Sulla > > wrote: > >> I must say that I'm reading the documentation now, and it's a bit > >> confusing. In the

Re: frozenset can be altered by |=

2021-11-29 Thread Chris Angelico
completely true: they work but they don't mutate the > original object. The same for += and *= that are listed under `list` > only. > Previously explained here: > > On Mon, 22 Nov 2021 at 14:59, Chris Angelico wrote: > > > > > > Yeah, it's a little

Re: Negative subscripts

2021-11-29 Thread Chris Angelico
On Tue, Nov 30, 2021 at 6:45 AM dn via Python-list wrote: > > > > On 27/11/2021 21.23, Chris Angelico wrote: > > On Sat, Nov 27, 2021 at 7:21 PM dn via Python-list > > wrote: > >> The expression list is evaluated once; it should yield an iterable &g

Re: print('\N{flag: Mauritius}') not supported in py3.9

2021-11-28 Thread Chris Angelico
On Mon, Nov 29, 2021 at 8:10 AM dn via Python-list wrote: > However, when trying the above, with our local flag in (Fedora Linux, > Gnome) Terminal or PyCharm's Run terminal; the two letters "N" and "Z" > are shown with dotted-outlines. Similarly, the Mauritius' flag is shown > as "M" and "U". >

Re: print('\N{flag: Mauritius}') not supported in py3.9

2021-11-28 Thread Chris Angelico
On Mon, Nov 29, 2021 at 12:29 AM Abdur-Rahmaan Janhangeer wrote: > > Greetings, > > I get you but why do the short names work for some and not for > others? > Which ones work? The ones that can be identified by a single codepoint? Look at the specification for Python's \N escapes. ChrisA --

Re: print('\N{flag: Mauritius}') not supported in py3.9

2021-11-28 Thread Chris Angelico
On Mon, Nov 29, 2021 at 12:10 AM Abdur-Rahmaan Janhangeer wrote: > I found the whole CLDR short name here: > https://unicode.org/emoji/charts/full-emoji-list.html > > However when i do > > >>> print('\N{flag: Mauritius}') > File "", line 1 > print('\N{flag: Mauritius}') >

Re: CERTIFICATE_VERIFY_FAILED Windows only?

2021-11-27 Thread Chris Angelico
On Sun, Nov 28, 2021 at 6:38 AM Ulli Horlacher wrote: > > My program uses https and runs fine on Linux, but on Windows it crashes: > > Google chrome and firefox both say the certifacte is valid: > > https://fex.flupp.org/fop/U4xC4kz8/X-20211127192031.png > >

Re: Negative subscripts

2021-11-27 Thread Chris Angelico
On Sat, Nov 27, 2021 at 7:21 PM dn via Python-list wrote: > The expression list is evaluated once; it should yield an iterable > object. An iterator is created for the result of the expression_list. > The suite is then executed once for each item provided by the iterator, > in the order returned

Re: pyinstaller wrong classified as Windows virus

2021-11-26 Thread Chris Angelico
On Sat, Nov 27, 2021 at 4:47 PM Ulli Horlacher wrote: > > Richard Damon wrote: > > > On a somewhat locked down computer, the user does not have admin rights, > > so needs to get 'IT' to run any installers that need admin permissions > > to run. > > > > And EXE that just needs to be copied to the

Re: Negative subscripts

2021-11-26 Thread Chris Angelico
On Fri, Nov 26, 2021 at 10:11 PM Rob Cliffe via Python-list wrote: > or, perhaps simplest, you could do > > for item in x[:-y or None]: # a value of None for a slice argument means > "don't slice here" > [do stuff] > This is the one I'd recommend. If you're negating a slice like this, just

Re: pyinstaller wrong classified as Windows virus

2021-11-25 Thread Chris Angelico
On Fri, Nov 26, 2021 at 7:53 AM Mats Wichmann wrote: > > On 11/25/21 11:00, Chris Angelico wrote: > > > Can someone confirm that it's still possible to run the Python > > installer without admin rights, for a per-user installation? It always > > used to be possible, but

Re: pyinstaller wrong classified as Windows virus

2021-11-25 Thread Chris Angelico
On Fri, Nov 26, 2021 at 4:50 AM Richard Damon wrote: > > On 11/25/21 12:21 PM, Chris Angelico wrote: > > On Fri, Nov 26, 2021 at 4:18 AM Ulli Horlacher > > wrote: > >> Chris Angelico wrote: > >> > >>> Unfortunately, if you're not going to go

Re: pyinstaller wrong classified as Windows virus

2021-11-25 Thread Chris Angelico
On Fri, Nov 26, 2021 at 4:18 AM Ulli Horlacher wrote: > > Chris Angelico wrote: > > > Unfortunately, if you're not going to go to the effort of getting your > > executables signed > > I cannot sign my executables (how can I do it anyway?), because Windows > dele

Re: pyinstaller wrong classified as Windows virus

2021-11-25 Thread Chris Angelico
On Fri, Nov 26, 2021 at 3:49 AM Ulli Horlacher wrote: > > Ulli Horlacher wrote: > > Dan Purgert wrote: > > > > > > When I compile my programs with pyinstaller, Windows classifies them as > > > > virus and even deletes them! > > > > [...] > > > > > > Have you tried compiling from a different

Re: Unexpected behaviour of math.floor, round and int functions (rounding)

2021-11-23 Thread Chris Angelico
On Wed, Nov 24, 2021 at 3:04 AM ast wrote: > > Le 19/11/2021 à 21:17, Chris Angelico a écrit : > > On Sat, Nov 20, 2021 at 5:08 AM ast wrote: > >> > >> Le 19/11/2021 à 03:51, MRAB a écrit : > >>> On 2021-11-19 02:40, 2qdxy4rzwzuui...@potatochowder.c

Re: frozenset can be altered by |=

2021-11-22 Thread Chris Angelico
On Tue, Nov 23, 2021 at 12:52 AM David Raymond wrote: > It is a little confusing since the docs list this in a section that says they > don't apply to frozensets, and lists the two versions next to each other as > the same thing. > >

Re: Unexpected behaviour of math.floor, round and int functions (rounding)

2021-11-21 Thread Chris Angelico
On Mon, Nov 22, 2021 at 5:42 AM Peter J. Holzer wrote: > (I think I used Math::BigRat in Perl, but I've been > programming in Perl for a lot longer.) > Rodents Of Unusual Size? I don't think they exist... ChrisA -- https://mail.python.org/mailman/listinfo/python-list

Re: get_axes not present?

2021-11-21 Thread Chris Angelico
On Mon, Nov 22, 2021 at 3:40 AM Mahmood Naderan via Python-list wrote: > File > "/home/mahmood/.local/lib/python3.8/site-packages/pandas/plotting/_matplotlib/core.py", > line 903, in _get_subplots > ax for ax in self.axes[0].get_figure().get_axes() if isinstance(ax, > Subplot) >

Re: Unexpected behaviour of math.floor, round and int functions (rounding)

2021-11-20 Thread Chris Angelico
On Sun, Nov 21, 2021 at 1:20 PM Rob Cliffe via Python-list wrote: > > > > On 21/11/2021 01:02, Chris Angelico wrote: > > > > If you have a number with a finite binary representation, you can > > guarantee that it can be represented finitely in decimal too. > >

Re: Unexpected behaviour of math.floor, round and int functions (rounding)

2021-11-20 Thread Chris Angelico
On Sun, Nov 21, 2021 at 12:56 PM Avi Gross via Python-list wrote: > > Not at all, Robb. I am not intending to demean Mathematicians as one of my > degrees is in that subject and I liked it. I mean that some things in > mathematics are not as intuitive to people when they first encounter them,

<    2   3   4   5   6   7   8   9   10   11   >