Re: comparing two lists

2021-02-24 Thread MRAB
On 2021-02-25 00:42, Davor Levicki wrote: i have two lists list1 = ['01:15', 'abc', '01:15', 'def', '01:45', 'ghi' ] list2 = ['01:15', 'abc', '01:15', 'uvz', '01:45', 'ghi' ] and when I loop through the list list_difference = [] for item in list1: if item not in list2: list_differen

Re: Tkinter long-running window freezes

2021-02-25 Thread MRAB
On 2021-02-25 20:57, Christian Gollwitzer wrote: Am 24.02.21 um 12:35 schrieb John O'Hagan: Hi list I have a 3.9 tkinter interface that displays data from an arbitrary number of threads, each of which runs for an arbitrary period of time. A frame opens in the root window when each thread starts

Re: editor recommendations?

2021-02-26 Thread MRAB
On 2021-02-26 14:51, Ethan Furman wrote: I'm looking for an editor to use for Python programming, as well as related incidentals such as markdown files, restructured text, etc. I'm currently using vim, and the primary reason I've stuck with it for so long is because I can get truly black scree

Re: Tkinter needed as a legacy version 2.7 imports the module...

2021-02-26 Thread MRAB
On 2021-02-26 22:23, Kevin M. Wilson via Python-list wrote: Hey Community,    Is there a site where I might/can download a version of Tkinter for Python 2.7? Tkinter as already included in Python 2.7. -- https://mail.python.org/mailman/listinfo/python-list

Re: Tkinter long-running window freezes

2021-02-26 Thread MRAB
On 2021-02-26 23:59, John O'Hagan wrote: On Fri, 26 Feb 2021 08:19:14 +0100 Christian Gollwitzer wrote: Am 26.02.21 um 06:15 schrieb John O'Hagan: [...] > > I've followed your suggestions as per my last post, and can confirm > the same freezing behaviour when running your code directly as a

Re: Tkinter long-running window freezes

2021-02-26 Thread MRAB
On 2021-02-27 02:38, John O'Hagan wrote: On Sat, 27 Feb 2021 01:06:06 + MRAB wrote: On 2021-02-26 23:59, John O'Hagan wrote: > On Fri, 26 Feb 2021 08:19:14 +0100 > Christian Gollwitzer wrote: > >> Am 26.02.21 um 06:15 schrieb John O'Hagan: > [...

Re: weirdness with list()

2021-02-28 Thread MRAB
On 2021-02-28 23:28, Peter Otten wrote: On 28/02/2021 23:33, Marco Sulla wrote: On Sun, 28 Feb 2021 at 01:19, Cameron Simpson wrote: My object represents an MDAT box in an MP4 file: it is the ludicrously large data box containing the raw audiovideo data; for a TV episode it is often about 2GB

Re: a + not b

2021-03-03 Thread MRAB
On 2021-03-04 03:39, Avi Gross via Python-list wrote: As a guess, Rob, precedence rules for not may not bind as strongly as you think. 1 + (not 1) With parentheses, "not 1" is a subexpression that should be performed first and might return the value "False" 1 + False treats False in a numeri

Re: trouble using pygame

2021-03-05 Thread MRAB
On 2021-03-06 02:54, Quentin Bock wrote: So, I recently downloaded the pygame module, this code is from a youtube tutorial by the way, I am following along the tutorial, the error involves the pygame.init() and also says this: import pygame # Initialize Pygame pygame.init() #create the screen

Re: pygame errors

2021-03-06 Thread MRAB
On 2021-03-07 03:01, Quentin Bock wrote: #Space Invaders! #Title and Icon pygame.display.set_caption("Space Invaders") icon = pygame.image.load('space-invaders.png') pygame.display.set_icon(icon) #Player player_Image = pygame.image.load('player.png') player_X = 370 player_Y = 480 def player():

Re: "unexpected argument"

2021-03-09 Thread MRAB
On 2021-03-09 20:03, Quentin Bock wrote: Error 1: Space Invaders.py:90: SyntaxWarning: "is" with a literal. Did you mean "=="? if bullet_state is "fire": Error 2: line 66, in if event.key == pygame.K_SPACE: AttributeError: 'Event' object has no attribute 'key' Code: import pygame impor

Re: Found a problem

2021-03-09 Thread MRAB
On 2021-03-09 20:16, Victor Dib wrote: Olá, comunidade do Python! [snip] def num_perf_inf(n): divisors = [] perfects = [] limit = n - 1 for i in range(1, limit): dividend = i + 1 for j in range(i): divisor = j + 1 if dividend % d

Re: pygame font issue

2021-03-13 Thread MRAB
On 2021-03-13 15:20, Quentin Bock wrote: Code that contains the problem: score_value = 0 font = pygame.font.SysFont('freesansbold.ttf', 32) error: in font_constructor font = Font(fontpath, size) pygame.error: font not initialized Can someone explain why it's saying font not initialized and pro

Re: .title() - annoying mistake

2021-03-19 Thread MRAB
On 2021-03-19 17:19, Abdur-Rahmaan Janhangeer wrote: Aie sorry, Did not know it targetted the non-english speakers. You want English "man's" to become "Man's", but French "l'homme" to become "L'Homme". It's language-dependant. -- https://mail.python.org/mailman/listinfo/python-list

Re: .title() - annoying mistake

2021-03-21 Thread MRAB
On 2021-03-21 22:30, Chris Angelico wrote: On Mon, Mar 22, 2021 at 9:04 AM Grant Edwards wrote: On 2021-03-21, Chris Angelico wrote: > On Mon, Mar 22, 2021 at 2:16 AM Robert Latest via Python-list wrote: > >> I wonder if .title() properly capitalizes titles in any language. It doesn't in >

Re: Pips for python2 and python3

2021-03-21 Thread MRAB
Tn 2021-03-21 23:13, Tim Johnson wrote: Using ubuntu 20.04 as a recent install with python3 (3.8.5) which was installed as part of the original distribution install and python2 (2.7.18) that has been installed using apt. I have a large amount of utilities written in python2 which I need to maint

Re: Pips for python2 and python3

2021-03-21 Thread MRAB
On 2021-03-22 01:34, Tim Johnson wrote: On 3/21/21 5:14 PM, MRAB wrote: Tn 2021-03-21 23:13, Tim Johnson wrote: Using ubuntu 20.04 as a recent install with python3 (3.8.5) which was installed as part of the original distribution install and python2 (2.7.18) that has been installed using apt

Re: python documentation

2021-03-26 Thread MRAB
On 2021-03-27 03:44, Chris Angelico wrote: On Sat, Mar 27, 2021 at 2:15 PM wrote: [snip] By the way, there is more, Blythooon offers beyond what I already have written in the last email. Otherwise please name me another comparable MINIMAL 'distribution', which is compiled specifically for sc

Re: python documentation

2021-03-27 Thread MRAB
On 2021-03-27 17:03, pyt...@blackward.eu wrote: You write, that "Everyone claims that it's easier to move to some other language rather than to migrate to Python 3". Thank you for sharing this remarkable information! You've quoted him partially and incorrectly. He said "Everyone claims that it

Re: python documentation

2021-03-27 Thread MRAB
On 2021-03-27 19:02, pyt...@blackward.eu wrote: You say: "The point is that there are those who use Python 2 and don't want to move to Python 3, claiming that it's easier to switch from Python 2 to some other language than from Python 2 to Python 3. That's what seems questionable." And I say, fo

Re: Unable to use pip to install packages

2021-04-01 Thread MRAB
On 2021-04-01 19:42, Md Sohail Ansari via Python-list wrote: Hi Team, Thanks for your support. I am having trouble installing any packages using pip in Python 3.x (earlier had Python 3.8.3, so changed to 3.8.8) in Windows 10. Please help me with below issues:

Re: all versions of python fail to indent after conditional statement

2021-04-02 Thread MRAB
On 2021-04-02 01:40, mikedianete...@gmail.com wrote: The following snap shot of system prompt illustrates my problem. I have tried 3.8, 3.92 and 3.10 with the same result. When I run in the window interface it doesn't even display one row of ... but does print if I hit return tw

Re: PyWin32 : When using Microsoft Word in code , opening it doesn't work

2021-04-08 Thread MRAB
On 2021-04-08 23:35, VISHESH MANGLA wrote: On Friday, April 9, 2021 at 4:02:37 AM UTC+5:30, Chris Angelico wrote: On Fri, Apr 9, 2021 at 8:26 AM VISHESH MANGLA wrote: > > Please help with this . > > https://github.com/mhammond/pywin32/issues/1689 Did you follow the instructions in the first

Re: PyWin32 : When using Microsoft Word in code , opening it doesn't work

2021-04-08 Thread MRAB
On 2021-04-09 00:15, VISHESH MANGLA wrote: On Friday, April 9, 2021 at 4:42:38 AM UTC+5:30, MRAB wrote: On 2021-04-08 23:35, VISHESH MANGLA wrote: > On Friday, April 9, 2021 at 4:02:37 AM UTC+5:30, Chris Angelico wrote: >> On Fri, Apr 9, 2021 at 8:26 AM VISHESH MANGLA

Re: need help with a translation issue

2021-04-17 Thread MRAB
On 2021-04-17 23:56, Quentin Bock wrote: I'm trying to take the user input and let them change the target language or dest code: from deep_translator import GoogleTranslator import googletrans import sys language_list = googletrans.LANGUAGES print(language_list) feedback = input("Would you lik

Re: Bloody rubbish

2021-05-06 Thread MRAB
On 2021-05-06 21:35, Gene Heskett wrote: On Thursday 06 May 2021 13:54:23 Skip Montanaro wrote: > Machine language is so much simpler, and you can code with just a > hexpad. Pshaa... All you need are front panel switches. ;-) (Yes, I had a professor who required is to 'key' in our programs on

Re: Python script accessing own source code

2021-05-12 Thread MRAB
On 2021-05-12 15:48, Michael F. Stemper wrote: On 12/05/2021 08.26, Dino wrote: Hi, here's my (probably unusual) problem. Can a Python (3.7+) script access its own source code? Here is a fairly simple python program that reads itself: #!/usr/b

Re: learning python ...

2021-05-23 Thread MRAB
On 2021-05-23 20:34, hw wrote: On 5/23/21 7:28 PM, Peter Otten wrote: On 23/05/2021 06:37, hw wrote: Hi, I'm starting to learn python and have made a little example program following a tutorial[1] I'm attaching. Running it, I'm getting: Traceback (most recent call last):    File "[...]/h

Re: imaplib: is this really so unwieldy?

2021-05-25 Thread MRAB
On 2021-05-25 16:41, Dennis Lee Bieber wrote: On Tue, 25 May 2021 10:23:41 +0200, hw declaimed the following: So I'm forced to convert stuff from bytes to strings (which is weird because bytes are bytes) and to use regular expressions to extract the message-uids from what the functions retu

Re: name for new Enum decorator

2021-05-28 Thread MRAB
On 2021-05-28 04:23, Ethan Furman wrote: Greetings! The Flag type in the enum module has had some improvements, but I find it necessary to move one of those improvements into a decorator instead, and I'm having a hard time thinking up a name. [snip] So, like the enum.unique decorator that c

Re: Applying winpdb_reborn

2021-05-28 Thread MRAB
On 2021-05-28 16:34, Rich Shepard wrote: I'm trying to debug a module of a PyQt5 application using winpdb_reborn. When I invoke the debugger with the module's name I get an empty winpdb window and the console tells me that it cannot find RPDBTERM. The full traceback is attached. Here, rpdb2 is a

Re: Why the list creates in two different ways? Does it cause by the mutability of its elements? Where the Python document explains it?

2021-06-15 Thread MRAB
On 2021-06-15 17:18, Dieter Maurer wrote: Chris Angelico wrote at 2021-6-15 19:08 +1000: On Tue, Jun 15, 2021 at 6:32 PM Dieter Maurer wrote: Chris Angelico wrote at 2021-6-15 05:35 +1000: >On Tue, Jun 15, 2021 at 5:12 AM Jach Feng wrote: >> >> >>> n = [(1,2) for i in range(3)] >> >>> n >> [

Re: Help with Python circular error

2021-06-15 Thread MRAB
On 2021-06-15 17:49, Chris Angelico wrote: On Wed, Jun 16, 2021 at 2:45 AM Arak Rachael wrote: Hi to everyone, I am having a problem with this error, I created a package and uploaded it to Test PyPi, but I can not get it to work, can someone help me please? https://test.pypi.org/manage/proj

Re: Faker package

2021-06-18 Thread MRAB
On 2021-06-18 23:24, Rich Shepard wrote: I'm trying to use the faker package to generate data to load in a sample postgres database so I can learn how to use tksheet and psycopg2. The 8.8.1 documentation shows output on a root shell prompt (#), not a python prompt (>>>). It also has a descriptio

Re: Faker package

2021-06-18 Thread MRAB
On 2021-06-19 02:51, Rich Shepard wrote: On Sat, 19 Jun 2021, MRAB wrote: When it says "command line" it means the operating system's command line. If it's the Python shell , it'll say "Python shell" or "Python prompt. MRAB, The root shell's (#)

Re: Paramiko installation issue

2021-06-29 Thread MRAB
On 2021-06-29 15:01, Sourav Bose wrote: Hello, I was using Python 3.8 32 bit ,but while trying to install the paramiko there is some wheel issue I'm facing. definitely it is due to version mismatching of the python and the paramiko. I have uninstalled 3.8 Could you please help me by providing

Re: Simple SSL client hangs

2021-07-13 Thread MRAB
On 2021-07-13 08:50, Loris Bennett wrote: Hi, In Perl I have the following use IO::Socket::SSL; my $my_socket = new IO::Socket::SSL(PeerAddr => 'some.server.somewhere, PeerPort => 12345, ); my $line = <$my_soc

Re: Searching pypi.org, is there an 'advanced search'?

2021-07-17 Thread MRAB
On 2021-07-17 13:01, Chris Green wrote: Every time I go to pypi.org to look for a neat utility or something I curse the stupid search. Is there really no better search available? Apart from anything else it appears to OR the elements together so, for example, I wanted to search for programs/lib

Re: Defining a Python enum in a C extension - am I doing this right?

2021-07-23 Thread MRAB
On 2021-07-23 09:20, Bartosz Golaszewski wrote: Hi! I'm working on a Python C extension and I would like to expose a custom enum (as in: a class inheriting from enum.Enum) that would be entirely defined in C. It turned out to not be a trivial task and the regular mechanism for inheritance using

Re: 'Pygame Module' not working

2021-07-31 Thread MRAB
On 2021-07-31 20:46, Dennis Lee Bieber wrote: On Sat, 31 Jul 2021 14:07:05 +0530, 37_VA_VEER CHAKRABORTY declaimed the following: pygame.image.load('assets/Flappy Bird.png') However, when I ran the script it was showing an error message - File not found Please advise me on how to upload the sp

Re: SQLALchemy: update with in clause from kwargs

2021-08-03 Thread MRAB
On 2021-08-04 02:08, Larry Martell wrote: I am trying to write a function that takes kwargs as a param and generates an update statement where the rows to be updated are specified in an in clause. Something like this: def update_by_in(self, **kwargs): filter_group = [] fo

Re: Flask – how to write csv file & save using prefilled value of the filename (response.headers["Content-Disposition"]="attachment; filename=xxx")

2021-08-06 Thread MRAB
On 2021-08-06 16:50, Suretha Weweje wrote: I am trying to upload a CSV file with flask, read and process one line at a time while iterating through all rows of the file and write the results back to a new CSV file. My python script produces the correct results on its own, but I am not able to ge

Re: CODING PAGE ACCESS

2021-08-07 Thread MRAB
On 2021-08-07 04:34, MICHAEL J W SMITH via Python-list wrote: I downloaded python. I selected it from the start menu. I clicked on:- Python 3-9New I got:- IDLE (Python 3.9 64-bit) Python 3.9 (64-bit) Python 3.9 Manuals (64-bit) Python 3.9 Module Docs (64-bit) I wish to access the page where I do

Re: some problems for an introductory python test

2021-08-11 Thread MRAB
On 2021-08-11 18:10, Wolfram Hinderer via Python-list wrote: Am 11.08.2021 um 05:22 schrieb Terry Reedy: Python is a little looser about whitespace than one might expect from reading 'normal' code when the result is unambiguous in that it cannot really mean anything other than what it does. 

Re: FW: Troubleshoot python app launch

2021-08-12 Thread MRAB
On 2021-08-12 03:31, Tan Jane wrote: From: [1]Tan Jane Sent: Wednesday, 11 August 2021 7:48 PM To: [2]python-list@python.org Subject: Troubleshoot python app launch Hi, I encountered attached screenshot issue while launching the python application downloaded fo

Re: some problems for an introductory python test

2021-08-12 Thread MRAB
On 2021-08-12 18:52, Grant Edwards wrote: On 2021-08-12, Hope Rouselle wrote: OS/2 had all kinds of amazing features (for its time). [...] Plus, it had this fancy concept of "extended attributes"; on older systems (like MS-DOS's "FAT" family), a file might be Read-Only, Hidden, a System file,

Re: Regarding inability of Python Module Winsound to produce beep in decimal frequency

2021-08-13 Thread MRAB
On 2021-08-13 17:17, Chris Angelico wrote: On Sat, Aug 14, 2021 at 2:11 AM Terry Reedy wrote: On 8/13/2021 6:53 AM, Umang Goswami wrote: > Hi There, Hope you find this mail in good health. > > I am Umang Goswami, a Python developer and student working on a huge > project for automation of musi

Re: please help

2021-08-16 Thread MRAB
On 2021-08-16 02:19, vitalis wrote: I keep getting this error while trying to install pyqt5 designer Fatal error in launcher: Unable to create process using '"c:\program files\python39\python.exe" "C:\Program Files\Python39\Scripts\pip.exe" install PyQt5Designer': The system can

Re: question on trax

2021-08-17 Thread MRAB
On 2021-08-17 16:50, joseph pareti wrote: In the following code, where does tl.Fn come from? i see it nowhere in the documents, i.e I was looking for trax.layers.Fn : import numpy as np *from trax import layers as tl* from trax import shapes from trax import fastmath # def Addition(): layer

Re: Compute working days

2021-08-18 Thread MRAB
On 2021-08-18 20:57, Bruno Lirio wrote: Em sábado, 14 de março de 2009 às 13:59:41 UTC-3, Casey escreveu: How about: from datetime import date, timedelta # Define the weekday mnemonics to match the date.weekday function (MON, TUE, WED, THU, FRI, SAT, SUN) = range(7) def workdays(start_date, end_

Re: what to do with multiple BOMs

2021-08-19 Thread MRAB
On 2021-08-19 14:07, Robin Becker wrote: Channeling unicode text experts and xml people: I have xml entity with initial bytes ff fe ff fe which the file command says is UTF-16, little-endian text. I agree, but what should be done about the additional BOM. A test output made many years ago seem

Re: on perhaps unloading modules?

2021-08-22 Thread MRAB
On 2021-08-22 17:18, Dennis Lee Bieber wrote: On Sat, 21 Aug 2021 17:15:14 -0300, Hope Rouselle declaimed the following: write some PHP precisely because it looked so much more cryptic than Allaire ColdFusion. Then C looked even more cryptic, so I fell in love with C. Try APL then..

Re: matplotlib questions

2021-08-28 Thread MRAB
On 2021-08-28 04:39, Steve wrote: I would like to know how the data is placed on the Y-axis and at the tops of the bars. The data is not being shown properly. With some exceptions, it looks as if the data is getting sorted independently from the dates. OK, here is the code: ===

Re: The sqlite3 timestamp conversion between unixepoch and localtime can't be done according to the timezone setting on the machine automatically.

2021-08-31 Thread MRAB
On 2021-08-31 02:16, dn via Python-list wrote: On 31/08/2021 11.07, Dennis Lee Bieber wrote: On Sun, 29 Aug 2021 19:49:19 -0700 (PDT), "hongy...@gmail.com" declaimed the following: ... Might have helped to mention you were in China... To me, CST is North America Central Standard Time

Re: The sqlite3 timestamp conversion between unixepoch and localtime can't be done according to the timezone setting on the machine automatically.

2021-08-31 Thread MRAB
On 2021-08-31 22:53, 2qdxy4rzwzuui...@potatochowder.com wrote: On 2021-09-01 at 07:32:43 +1000, Chris Angelico wrote: On Wed, Sep 1, 2021 at 7:17 AM <2qdxy4rzwzuui...@potatochowder.com> wrote: > What about Phoenix? In the winter, it's the same time there as it is in > San Francisco, but in

Re: The sqlite3 timestamp conversion between unixepoch and localtime can't be done according to the timezone setting on the machine automatically.

2021-08-31 Thread MRAB
On 2021-08-31 23:31, Chris Angelico wrote: On Wed, Sep 1, 2021 at 8:22 AM MRAB wrote: [snip] In the EU, DST in the member states changes at the same time. It's not like the US where it ripples across the timezones, so the differences vary during the change. It all happens in one go.

Re: The sqlite3 timestamp conversion between unixepoch and localtime can't be done according to the timezone setting on the machine automatically.

2021-09-02 Thread MRAB
On 2021-09-02 08:40, Alan Gauld via Python-list wrote: On 31/08/2021 23:31, Chris Angelico wrote: Ah, good to know. I think that actually makes a lot of sense; in the US, they try to let everyone pretend that the rest of the world doesn't exist ("we always change at 2AM"), but in Europe, they t

Re: on floating-point numbers

2021-09-03 Thread MRAB
On 2021-09-03 16:13, Chris Angelico wrote: On Sat, Sep 4, 2021 at 12:08 AM o1bigtenor wrote: Hmmm - - - ZI would suggest that you haven't looked into taxation yet! In taxation you get a rational number that MUST be multiplied by the amount in currency. (You can, of course, multiply a curr

Re: Friday Finking: Contorted loops

2021-09-10 Thread MRAB
On 2021-09-10 12:38, Alan Gauld via Python-list wrote: On 09/09/2021 22:36, dn via Python-list wrote: Even in fairly modest Python constructs, we quickly repeal the one-in, one-out philosophy because try...except operates by providing another exit-path. Exceptions are exceptional by their nat

Re: How to support annotations for a custom type in a C extension?

2021-09-17 Thread MRAB
On 2021-09-17 21:03, Marco Sulla wrote: I created a custom dict in a C extension. Name it `promethea`. How can I implement `promethea[str, str]`? Now I get: TypeError: 'type' object is not subscriptable Somewhere you'll have a table of the class's methods. It needs an entry like this: stati

Re: How to support annotations for a custom type in a C extension?

2021-09-18 Thread MRAB
On 2021-09-18 16:09, Serhiy Storchaka wrote: 18.09.21 03:54, MRAB пише: static PyMethodDef customdict_methods[] = { ...     {"__class_getitem__", (PyCFunction)Py_GenericAlias, METH_CLASS | METH_O | METH_COEXIST, PyDoc_STR("See PEP 585")}, ... }; Note the flags: METH_CL

Re: How to support annotations for a custom type in a C extension?

2021-09-18 Thread MRAB
On 2021-09-18 16:10, Serhiy Storchaka wrote: 18.09.21 09:40, Marco Sulla пише: Ooook. I have a question. Why is this code not present in dictobject.c? Where are the dict annotations implemented? In dictobject.c. I just had a look at dictobject.c. It too has a cast to PyCFunction. -- http

Re: query

2021-09-19 Thread MRAB
On 2021-09-19 13:42, Shashwat Pandey wrote: -- Forwarded message - From: Date: Sun, Sep 19, 2021, 13:20 Subject: query To: Hello! I see you want to post a message to the Python List. We would be happy to help, but you must subscribe first: https://mail.python.org/mailman

Re: OT: AttributeError

2021-09-29 Thread MRAB
On 2021-09-29 03:03, 2qdxy4rzwzuui...@potatochowder.com wrote: On 2021-09-29 at 09:21:34 +1000, Chris Angelico wrote: On Wed, Sep 29, 2021 at 9:10 AM <2qdxy4rzwzuui...@potatochowder.com> wrote: > > On 2021-09-29 at 11:38:22 +1300, > dn via Python-list wrote: > > > For those of us who remember

Re: Connecting to MS accdb and read data into Pandas

2021-10-12 Thread MRAB
On 2021-10-12 09:40, Shaozhong SHI wrote: I tried the following code: import pyodbc conn = pyodbc.connect(r'Driver={Microsoft Access Driver (*.mdb, *.accdb)};DBQ=D:\my.accdb;') cursor = conn.cursor() cursor.execute('select * from table_name') for row in cursor.fetchall(): print (row) But

Re: Mailing list activity low

2021-10-12 Thread MRAB
On 2021-10-12 09:06, Antoon Pardon wrote: Have I missed something and has the maillinglist been moved. Activity is very low here, about one message every five days. I've had some messages delayed, but activity has been normal otherwise. -- https://mail.python.org/mailman/listinfo/python-list

Re: Request to advise error for python.

2021-10-23 Thread MRAB
On 2021-10-23 14:53, tommy yama wrote: It seems you use windows to install. Then, you need conda. Pip works for Linux. On Windows, 'conda' is for the Anaconda version of Python. If you're using the standard version of Python from python.org you use pip or, preferably, py -m pip. Check thi

Re: Unable to Install Matplotlib & Pandas for Python 3.10

2021-10-24 Thread MRAB
On 2021-10-24 12:41, Anik Dey wrote: Hello, I downloaded & installed Python 3.10 but it didn't replace Python 3.9. And now I can't install Matplotlib & Pandas. What should I do? Multiple versions of Python can exist alongside each other. You haven't said what you mean by "can't install". If y

Re: Unable to Install Matplotlib & Pandas for Python 3.10

2021-10-24 Thread MRAB
On 2021-10-24 23:59, Mats Wichmann wrote: On 10/24/21 09:46, MRAB wrote: > On 2021-10-24 12:41, Anik Dey wrote: >> Hello, I downloaded & installed Python 3.10 but it didn't replace Python >> 3.9. And now I can't install Matplotlib & Pandas. What should I do? >

Re: walrus with a twist :+= or ...

2021-10-27 Thread MRAB
On 2021-10-28 02:06, Avi Gross via Python-list wrote: I just realized I left out **= so my apologies. Are there other such abbreviations and does anyone use them? You forgot about the bitwise operators: |= &= ^= -Original Message- From: Python-list On Behalf Of Avi Gross via Python

Re: How to apply a self defined function in Pandas

2021-10-31 Thread MRAB
On 2021-10-31 17:25, Shaozhong SHI wrote: I defined a function and apply it to a column in Pandas. But it does not return correct values. I am trying to test which url in a column full of url to see which one can be connected to or not def connect(url): try: urllib.request.urlope

Re: How to apply a self defined function in Pandas

2021-10-31 Thread MRAB
On 2021-10-31 18:48, Shaozhong SHI wrote: On Sunday, 31 October 2021, MRAB wrote: On 2021-10-31 17:25, Shaozhong SHI wrote: I defined a function and apply it to a column in Pandas.  But it does not return correct values. I am trying to test which url in a

Re: System, configuration and Python performance

2021-11-01 Thread MRAB
On 2021-11-01 23:02, Shaozhong SHI wrote: How to configure to improve Python performance in a system like the following: Windows 10 System Processor Intel(R) Core(TM) i7-9700 CPU @3.60GHz, 3.60 GHz Installed memory (RAM) 32.0 GB (31.8 GB usable) System type: 64-bit Operating System, x64-based

Re: Problem with concatenating two dataframes

2021-11-06 Thread MRAB
On 2021-11-06 16:16, Mahmood Naderan via Python-list wrote: In the following code, I am trying to create some key-value pairs in a dictionary where the first element is a name and the second element is a dataframe. # Creating a dictionary data = {'Value':[0,0,0]} kernel_df = pd.DataFrame(data,

Re: Problem with concatenating two dataframes

2021-11-06 Thread MRAB
On 2021-11-06 20:12, Mahmood Naderan wrote: >Try this instead: > > >    dict[name] = pd.concat([dict[name], values]) OK. That fixed the problem, however, I see that they are concatenated vertically. How can I change that to horizontal? The printed dictionary in the end looks like {'dummy':

Re: Breaking new relic format on a new line character in FileHandler appender

2021-11-11 Thread MRAB
On 2021-11-10 05:16, Vijay Karavadra via Python-list wrote: Hello Team, I'm trying to add logs in the new relic platform from a python application. For that, I've to add logs in a local file in a specific format which is '{"log.level":"%(levelname)s", "log.entity.name":"my-service-name", "messa

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

2021-11-18 Thread MRAB
On 2021-11-19 02:40, 2qdxy4rzwzuui...@potatochowder.com wrote: On 2021-11-18 at 23:16:32 -0300, René Silva Valdés wrote: Hello, I would like to report the following issue: Working with floats i noticed that: int(23.99/12) returns 1, and int(23.999/12) returns 2 This

Re: pytest segfault, not with -v

2021-11-19 Thread MRAB
On 2021-11-19 17:48, Marco Sulla wrote: I have a battery of tests done with pytest. My tests break with a segfault if I run them normally. If I run them using pytest -v, the segfault does not happen. What could cause this quantical phenomenon? Are you testing an extension that you're compiling?

Re: frozenset can be altered by |=

2021-11-19 Thread MRAB
On 2021-11-19 21:11, Marco Sulla wrote: (venv_3_10) marco@buzz:~$ 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 = frozenset((3, 4)) a frozenset({3, 4}) a |= {5,}

Re: pytest segfault, not with -v

2021-11-19 Thread MRAB
On 2021-11-19 23:44, Marco Sulla wrote: On Fri, 19 Nov 2021 at 20:38, MRAB wrote: On 2021-11-19 17:48, Marco Sulla wrote: > I have a battery of tests done with pytest. My tests break with a > segfault if I run them normally. If I run them using pytest -v, the > segfault does n

Re: pytest segfault, not with -v

2021-11-20 Thread MRAB
hen it should be constant over time. On Sat, 20 Nov 2021 at 01:46, MRAB wrote: On 2021-11-19 23:44, Marco Sulla wrote: > On Fri, 19 Nov 2021 at 20:38, MRAB wrote: >> >> On 2021-11-19 17:48, Marco Sulla wrote: >> > I have a battery of tests done with pytest. My tests

Re: No right operator in tp_as_number?

2021-11-20 Thread MRAB
On 2021-11-20 17:45, Marco Sulla wrote: I checked the documentation: https://docs.python.org/3/c-api/typeobj.html#number-structs and it seems that, in the Python C API, the right operators do not exist. For example, there is nb_add, that in Python is __add__, but there's no nb_right_add, that in

Re: get_axes not present?

2021-11-21 Thread MRAB
On 2021-11-21 16:39, Mahmood Naderan via Python-list wrote: The best way to get assistance here on the list is to create a minimal, self-contained, run-able, example program that you can post in its entirety here that demonstrates the issue. I created a sample code with input. Since the code p

Re: doubt About import machine

2021-11-21 Thread MRAB
On 2021-11-21 18:36, Daniel Eduardo Almeida Correa wrote: Hello, I'm trying to use the machine library in python 3.10 version, but I can't import it with the pip install machine, could you tell me a way to solve it or a python version compatible with the library? Thank you a lot for your answer.

Re: Embedding Python crash on PyTuple_New

2021-11-23 Thread MRAB
On 2021-11-23 12:07, Arnaud Loonstra wrote: Hi, I've got Python embedded successfully in a program up until now as I'm now running into weird GC related segfaults. I'm currently trying to debug this but my understanding of CPython limits me here. I'm creating a Tuple in C but it crashes on crea

Re: Embedding Python crash on PyTuple_New

2021-11-23 Thread MRAB
On 2021-11-23 14:44, Arnaud Loonstra wrote: On 23-11-2021 15:34, MRAB wrote: On 2021-11-23 12:07, Arnaud Loonstra wrote: Hi, I've got Python embedded successfully in a program up until now as I'm now running into weird GC related segfaults. I'm currently trying to de

Re: Embedding Python crash on PyTuple_New

2021-11-23 Thread MRAB
On 2021-11-23 15:17, MRAB wrote: On 2021-11-23 14:44, Arnaud Loonstra wrote: On 23-11-2021 15:34, MRAB wrote: On 2021-11-23 12:07, Arnaud Loonstra wrote: Hi, I've got Python embedded successfully in a program up until now as I'm now running into weird GC related segfaults. I&#

Re: Embedding Python crash on PyTuple_New

2021-11-23 Thread MRAB
On 2021-11-23 16:04, Arnaud Loonstra wrote: On 23-11-2021 16:37, MRAB wrote: On 2021-11-23 15:17, MRAB wrote: On 2021-11-23 14:44, Arnaud Loonstra wrote: On 23-11-2021 15:34, MRAB wrote: On 2021-11-23 12:07, Arnaud Loonstra wrote: Hi, I've got Python embedded successfully in a progr

Re: Embedding Python crash on PyTuple_New

2021-11-23 Thread MRAB
On 2021-11-23 17:31, MRAB wrote: On 2021-11-23 16:04, Arnaud Loonstra wrote: [snip] I would turn my attention to s_py_zosc function but I'm not sure. Since the errors are GC related it could caused anywhere? Basically, yes, but I won't be surprised if it was due to too few INCR

Re: Embedding Python crash on PyTuple_New

2021-11-23 Thread MRAB
On 2021-11-23 20:25, Arnaud Loonstra wrote: On 23-11-2021 18:31, MRAB wrote: On 2021-11-23 16:04, Arnaud Loonstra wrote: On 23-11-2021 16:37, MRAB wrote: On 2021-11-23 15:17, MRAB wrote: On 2021-11-23 14:44, Arnaud Loonstra wrote: On 23-11-2021 15:34, MRAB wrote: On 2021-11-23 12:07

Re: Embedding Python crash on PyTuple_New

2021-11-24 Thread MRAB
On 2021-11-24 07:59, Arnaud Loonstra wrote: On 24-11-2021 01:46, MRAB wrote: On 2021-11-23 20:25, Arnaud Loonstra wrote: On 23-11-2021 18:31, MRAB wrote: On 2021-11-23 16:04, Arnaud Loonstra wrote: On 23-11-2021 16:37, MRAB wrote: On 2021-11-23 15:17, MRAB wrote: On 2021-11-23 14:44

Re: Short, perfect program to read sentences of webpage

2021-12-08 Thread MRAB
On 2021-12-08 19:39, Julius Hamilton wrote: Hey, This is something I have been working on for a very long time. It’s one of the reasons I got into programming at all. I’d really appreciate if people could input some advice on this. This is a really simple program which extracts the text from we

Re: Short, perfect program to read sentences of webpage

2021-12-08 Thread MRAB
On 2021-12-08 23:17, Stefan Ram wrote: Cameron Simpson writes: Instead, consider the \b (word boundary) and \w (word character) markers, which will let you break strings up, and then maybe test the results with str.isupper(). Thanks for your comments, most or all of them are valid, and

Re: problem reading a CSV file

2021-12-13 Thread MRAB
On 2021-12-12 23:37, 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 file name in the open stateme

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

2021-12-30 Thread MRAB
On 2021-12-30 23:27, hongy...@gmail.com wrote: On Friday, December 31, 2021 at 7:04:24 AM UTC+8, Chris Angelico wrote: Neither of these wants to be recursive, and writing them recursively pollutes the function signature with parameters that really exist just to be local variables. Passing an ac

Re: Shapely Polygon creating empty polygon

2022-01-04 Thread MRAB
On 2022-01-04 22:57, Israel Brewster wrote: I’m running into an issue with shapely that is baffling me. Perhaps someone here can help out? When running shapely directly from a python 3.8 interpreter, it works as expected: import shapely shapely.__version__ '1.8.0' from shapely.geometry imp

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

2022-01-07 Thread MRAB
On 2022-01-06 18:55, NArshad wrote: All this is going to be in python’s flask and HTML only 1. First, I have to check in the Excel sheet or table whether the book user has entered is present in the book bank or not. 2. If a book is present and the quantity of the required book is greater than

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

2022-01-09 Thread MRAB
On 2022-01-09 07:04, NArshad wrote: On Friday, 7 January 2022 at 02:59:17 UTC+5, alister wrote: On Thu, 6 Jan 2022 10:55:30 -0800 (PST), NArshad wrote: > All this is going to be in python’s flask and HTML only > > 1. First, I have to check in the Excel sheet or table whether the book > user

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

2022-01-10 Thread MRAB
On 2022-01-10 16:39, NArshad wrote: Using openpyxl is pretty straightforward: from openpyxl import load_workbook wb = load_workbook(spreadsheet_path) sheet = wb.active # Reading the values in cells: print('Cell A1 contains', sheet['A1'].value) print('Cell A2 contains', sheet['A2'].value) prin

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

2022-01-12 Thread MRAB
On 2022-01-11 06:31, NArshad wrote: -“How are the relevant cells identified in the spreadsheet?” The column headings are: BOOK_NAME BOOK_AUTHOR BOOK_ISBN TOTAL_COPIES COPIES_LEFT BORROWER’S_NAME ISSUE_DATE RETURN_DATE -“It's often the case that the cells on the first row contain text as column

<    4   5   6   7   8   9   10   11   12   13   >