Re: Unexpected Inheritance Problem
On 20/05/2021 06:00, Richard Damon wrote: class GedcomHead(Gedcom0Tag): """GEDCOM 0 HEAD tag""" def ___init___(self, *, parent): An __init__ with three underscores; you must me joking ;) -- https://mail.python.org/mailman/listinfo/python-list
Re: Unexpected Inheritance Problem
On 5/20/21 3:24 AM, Peter Otten wrote: > On 20/05/2021 06:00, Richard Damon wrote: > >> class GedcomHead(Gedcom0Tag): >> """GEDCOM 0 HEAD tag""" >> def ___init___(self, *, parent): > > An __init__ with three underscores; you must me joking ;) > Yes, that is what I was missing, too many underscores there, so GedcomHead didn't have an __init__ so it inherited inherited from it from its base with the wrong signature. Thank you. -- Richard Damon -- https://mail.python.org/mailman/listinfo/python-list
Re: Unexpected Inheritance Problem
On 5/20/21 1:58 AM, Chris Angelico wrote: > On Thu, May 20, 2021 at 2:02 PM Richard Damon > wrote: >> Given the following definition of classes, I am getting an unexpected >> error of : >> >> TypeError: __init__() missing 2 required keyword-only arguments: >> 'idcode' and 'tag' >> >> On the call to create a GedcomHead in the call to GedcomHead() in >> Gedcom0Tag.add() >> >> class Gedcom0Tag(GedcomTag): >> """Represents a Level 0 Tag of a GEDCOM file""" >> >> @classmethod >> def add(cls, *, parent, tag: str, payload: str, level=0): >> >> Gedcom0Tag.add(parent, 'Head', '') >> > You're defining that add takes keyword-only args (because the asterisk > stops them from being passed positionally), but then you're calling it > with nothing but positional args. Is that the code you're using? I > would expect to see *three* missing kwonly args from this. > > ChrisA The last line wasn't copied but distiled from the rest of the code to simplify the segment. The actual code had the parameters named in the call. Peter found the error with too many underscores on init. -- Richard Damon -- https://mail.python.org/mailman/listinfo/python-list
Re: Unexpected Inheritance Problem
On 5/20/21 4:54 AM, Richard Damon wrote: On 5/20/21 3:24 AM, Peter Otten wrote: On 20/05/2021 06:00, Richard Damon wrote: class GedcomHead(Gedcom0Tag): """GEDCOM 0 HEAD tag""" def ___init___(self, *, parent): An __init__ with three underscores; you must me joking ;) Yes, that is what I was missing, too many underscores there, so GedcomHead didn't have an __init__ so it inherited inherited from it from its base with the wrong signature. Thank you. many fonts squish together repeated underscores in the display so it's hard to see this visually, I've had a problem or two of this nature as well (a keyboard that got a little "bouncy" and more than once doubled keypresses). Even with an IDE - well, you can define whatever you want, so it's not an error that you "spelled it funny", right? -- https://mail.python.org/mailman/listinfo/python-list
Python install failing. Install log is available.
Hi, I've usually had problems installing python, typically pip breaking. This time it's simply not installing correctly when run as administrator, and not at all when run as non-administrator. As administrator, it's not installing for other users as I believe it should. It's certainly not adding the python path correctly *for all users* (install option "add python to environment variables"), from a command console run as admin: C:\WINDOWS\system32>whoami antik\administrator C:\WINDOWS\system32>echo %PATH% C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files\dotnet\;C:\Program Files\TortoiseGit\bin;C:\Users\Administrator\AppData\Local\Programs\Python\Python39\Scripts\;C:\Users\Administrator\AppData\Local\Programs\Python\Python39\;C:\Users\Administrator\AppData\Local\Microsoft\WindowsApps;C:\Users\Administrator\.dotnet\tools It's there, but from a non-admin console (I work just a normal user): C:\Users\jan>whoami antik\jan C:\Users\jan>echo %path% C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files\dotnet\;C:\Program Files\TortoiseGit\bin;C:\Users\jan\AppData\Local\Microsoft\WindowsApps;C:\Users\jan\AppData\Local\Programs\Git\cmd So no python path added. When install is run as non-administrator it seems to fail outright due to lack of privileges. The install log for this non-admin is available on request (I'd rather not attach it as it contain have sensitive info, but can post it publicly if really wanted. It's 60K). I tried elevating my non-admin account to admin then re-running the python installer, it broke. Trying to reinstall it has now lost all associations with the .py extension. I don't know what's going on. My build depends on python and obviously that's failing now. I've worked around it by downloading and unzipping python embedded, setting the file association and hardcoding file paths, but that's certainly not ideal. Any thoughts? Using python-3.9.5-amd64.exe, OS is win 2016 server eval, fresh install. -- https://mail.python.org/mailman/listinfo/python-list
If you have Python Cookbook, 3rd ed.
can you verify that the Algorithm chapter (near end in 2nd ed.) does *NOT* have an introduction by Tim Peters? (Info needed to verify timeit doc correction https://github.com/python/cpython/pull/21744) -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list
Typing and Enum and Abstract
Here's a question on SO about typing, enum, and ABC: https://stackoverflow.com/q/67610562/208880 No answers so far. -- ~Ethan~ -- https://mail.python.org/mailman/listinfo/python-list
Re: If you have Python Cookbook, 3rd ed.
On Thu, May 20, 2021 at 11:43 AM Terry Reedy wrote: > > can you verify that the Algorithm chapter (near end in 2nd ed.) does > *NOT* have an introduction by Tim Peters? > (Info needed to verify timeit doc correction > https://github.com/python/cpython/pull/21744) In my 3rd edition copy chapter 1 is "Data Structures and Algorithms". The only thing comprising an introduction is a brief paragraph that starts the chapter and has no attribution. HTH, boB Stepp -- https://mail.python.org/mailman/listinfo/python-list
Re: Unexpected Inheritance Problem
On 2021-05-20, Mats Wichmann wrote: > On 5/20/21 4:54 AM, Richard Damon wrote: >> On 5/20/21 3:24 AM, Peter Otten wrote: >>> On 20/05/2021 06:00, Richard Damon wrote: >>> class GedcomHead(Gedcom0Tag): """GEDCOM 0 HEAD tag""" def ___init___(self, *, parent): >>> >>> An __init__ with three underscores; you must me joking ;) >>> >> Yes, that is what I was missing, too many underscores there, so >> GedcomHead didn't have an __init__ so it inherited inherited from it >> from its base with the wrong signature. > > many fonts squish together repeated underscores in the display so it's > hard to see this visually, Is it just me, or does it seem foolish to use such fonts for editing/browsing source code... -- Grant -- https://mail.python.org/mailman/listinfo/python-list
Use Chrome's / Firefox's dev-tools in python
My school has a website for homework called pronote (no problem if you don't know it). After logging in on parisclassenumerique.fr (works with selenium but I cant get requests to work), I want to read one of the packets that is sent: All the info about my day, my homework, etc. are in there and it is the perfect file: header request response stack trace The file's download address looks random. The login works only for a limited period of time in the same browser. Any ideas for using that tool of Firefox or same of Chrome? Thanks! -- https://mail.python.org/mailman/listinfo/python-list
Re: Use Chrome's / Firefox's dev-tools in python
On Fri, May 21, 2021 at 4:59 AM max pothier wrote: > > > > My school has a website for homework called pronote (no problem if you don't > know it). After logging in on parisclassenumerique.fr (works with selenium > but I cant get requests to work), I want to read one of the packets that is > sent: All the info about my day, my homework, etc. are in there and it is the > perfect file: header request response stack trace > > The file's download address looks random. The login works only for a limited > period of time in the same browser. > > Any ideas for using that tool of Firefox or same of Chrome? > Most likely, what you're looking at is going to require some sort of login token, a cookie or equivalent. It's not going to be easy to replicate that in Python without actually providing your login credentials. I'd say the easiest approach is going to be a hybrid of Python to do your processing, with some JavaScript to collect the request information. But it all depends on how much you want to automate this, and how much effort you're willing to put in. For instance, you could write a Chrome extension that is aware of the traffic, or perhaps it'd be sufficient to just paste some JavaScript code into the Dev Tools console before you send the request. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: Python install failing. Install log is available.
On 5/20/2021 7:06 AM, jan via Python-list wrote: This time it's simply not installing correctly when run as administrator, and not at all when run as non-administrator. As administrator, it's not installing for other users as I believe it should. It's certainly not adding the python path correctly *for all users* C:\WINDOWS\system32>whoami ... Any thoughts? On Windows, use the py launcher to launch python. It was added as the solution to problems with adding python paths, including problems with multiple installs and those with removing them. -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list
Re: If you have Python Cookbook, 3rd ed.
On 5/20/2021 1:14 PM, boB Stepp wrote: On Thu, May 20, 2021 at 11:43 AM Terry Reedy wrote: can you verify that the Algorithm chapter (near end in 2nd ed.) does *NOT* have an introduction by Tim Peters? (Info needed to verify timeit doc correction https://github.com/python/cpython/pull/21744) In my 3rd edition copy chapter 1 is "Data Structures and Algorithms". The only thing comprising an introduction is a brief paragraph that starts the chapter and has no attribution. Hmm. 2nd ed starts with 1. Text. The intro mentioned was for 18. Algorithms, starting with removing duplicates from a sequence. -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list
Re: If you have Python Cookbook, 3rd ed.
On Thu, May 20, 2021 at 3:48 PM Terry Reedy wrote: > > On 5/20/2021 1:14 PM, boB Stepp wrote: > > On Thu, May 20, 2021 at 11:43 AM Terry Reedy wrote: > >> > >> can you verify that the Algorithm chapter (near end in 2nd ed.) does > >> *NOT* have an introduction by Tim Peters? > >> (Info needed to verify timeit doc correction > >> https://github.com/python/cpython/pull/21744) > > > > In my 3rd edition copy chapter 1 is "Data Structures and Algorithms". > > The only thing comprising an introduction is a brief paragraph that > > starts the chapter and has no attribution. > > Hmm. 2nd ed starts with 1. Text. The intro mentioned was for 18. > Algorithms, starting with removing duplicates from a sequence. 3rd edition in chapter 1 starts with "1.1 Unpacking a Sequence into Separate Variables" Later in chapter is "1.10 Removing Duplicates from a Sequence while Maintaining Order". The preface does say the third edition is a major rewrite, so I suppose there will be significant differences from the 2nd edition which I don't own. boB Stepp -- https://mail.python.org/mailman/listinfo/python-list
Re: Unexpected Inheritance Problem
On 5/20/2021 2:53 PM, Grant Edwards wrote: On 2021-05-20, Mats Wichmann wrote: On 5/20/21 4:54 AM, Richard Damon wrote: On 5/20/21 3:24 AM, Peter Otten wrote: On 20/05/2021 06:00, Richard Damon wrote: class GedcomHead(Gedcom0Tag): """GEDCOM 0 HEAD tag""" def ___init___(self, *, parent): An __init__ with three underscores; you must me joking ;) Yes, that is what I was missing, too many underscores there, so GedcomHead didn't have an __init__ so it inherited inherited from it from its base with the wrong signature. many fonts squish together repeated underscores in the display so it's hard to see this visually, Is it just me, or does it seem foolish to use such fonts for editing/browsing source code... Windows 10, at least, has Source Code Pro, and variations, in which __init__ has distinct _s with a small space in between (unlike the default font here in Thunderbird, or in Firefox). This is the only monospaced TrueType font available in the Windows console with this property. -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list