Re: How do you find what exceptions a class can throw?

2020-12-21 Thread Chris Green
Avi Gross  wrote:
> The original question sounded like someone was asking what errors might be
> thrown for a routine they wrote that used other components that might
> directly throw exceptions or called yet others, ad nauseum.
> 
OP here.  The original question was because I wanted to trap timout
errors when connectiing to a POP3 server in a very simple little
program that collects mail and runs it through a filter before
delivering it.

Thus I simply needed to know what the 'name' of the exception was so I
could trap only timeouts.  Timeout errors are (probably) 'soft' errors
which merit a retry, most other errors when trying to connect to a POP
server would be unrecoverable (POP syntax, wrong name, wrong password,
etc.).

It didn't seem such a difficult question when I asked it! :-)

-- 
Chris Green
·
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: How do you find what exceptions a class can throw?

2020-12-21 Thread Larry Martell
On Sun, Dec 20, 2020 at 9:36 PM Chris Angelico  wrote:
>
> On Mon, Dec 21, 2020 at 1:11 PM Julio Di Egidio  wrote:
> > > Gathering evidence is indeed part of science, and computer science is
> > > indeed mathematics, but alas programmering is just a craft and software
> > > engineering often ... isn't.
> >
> > Programming is a *discipline*
>
> It's a discipline, a science, AND an art. I love programming :)


I love it too. But I think it’s a craft not an art. I think of art as
totally unconstrained, and a craft as having to functionally work.

I really like this quote: "Debugging is like being the detective in a
crime movie where you are also the murderer." - Filipe Fortes
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: How do you find what exceptions a class can throw?

2020-12-21 Thread Chris Angelico
On Tue, Dec 22, 2020 at 12:32 AM Larry Martell  wrote:
>
> On Sun, Dec 20, 2020 at 9:36 PM Chris Angelico  wrote:
> >
> > On Mon, Dec 21, 2020 at 1:11 PM Julio Di Egidio  wrote:
> > > > Gathering evidence is indeed part of science, and computer science is
> > > > indeed mathematics, but alas programmering is just a craft and software
> > > > engineering often ... isn't.
> > >
> > > Programming is a *discipline*
> >
> > It's a discipline, a science, AND an art. I love programming :)
>
>
> I love it too. But I think it’s a craft not an art. I think of art as
> totally unconstrained, and a craft as having to functionally work.

Hmmm...

*looks at some of his recent code*

This stuff has to work?!? I've been doing it all wrong...

> I really like this quote: "Debugging is like being the detective in a
> crime movie where you are also the murderer." - Filipe Fortes

Oh yes, absolutely. Only, you don't even know if a murder's been
committed yet...

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Python pyrebase user auth

2020-12-21 Thread Sadaka Technology
Hello guys, how can I get user auth refresh token  and local id ?
-- 
https://mail.python.org/mailman/listinfo/python-list


[RELEASE] Python 3.8.7 is now available

2020-12-21 Thread Łukasz Langa
Python 3.8.7 is the seventh maintenance release of Python 3.8. Go get it here:

https://www.python.org/downloads/release/python-387/ 

Note: this is a bugfix release for the 3.8 series which was superseded by 
Python 3.9, currently the latest feature release series of Python 3. You can 
find the latest release of 3.9.x here .

Maintenance releases for the 3.8 series will continue at regular bi-monthly 
intervals, with 3.8.8 planned for February 2021.

macOS 11 Big Sur not fully supported

Python 3.8.7 is not yet fully supported on macOS 11 Big Sur. It will install on 
macOS 11 Big Sur and will run on Apple Silicon Macs using Rosetta 2 
translation. However, a few features do not work correctly, most noticeably 
those involving searching for system libraries (vs user libraries) such as 
ctypes.util.find_library() and in Distutils. This limitation affects both Apple 
Silicon and Intel processors. We are looking into improving the situation for 
Python 3.8.8.

Python 3.9.1  provides 
full support for Big Sur and Apple Silicon Macs, including building natively on 
Apple Silicon Macs and support for universal2 binaries.

What’s new?

The Python 3.8 series contains many new features and optimizations over 3.7. 
See the “What’s New in Python 3.8 
” document for more information 
about features included in the 3.8 series.

Detailed information about all changes made in version 3.8.7 specifically can 
be found in its change log 
. 
Note that compared to 3.8.6 this release also contains all changes present in 
3.8.7rc1.

We hope you enjoy Python 3.8!

Thanks to all of the many volunteers who help make Python Development and these 
releases possible! Please consider supporting our efforts by volunteering 
yourself or through organization contributions to the Python Software 
Foundation.

Your friendly release team,
Ned Deily @nad 
Steve Dower @steve.dower 
Łukasz Langa @ambv 
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: How do you find what exceptions a class can throw?

2020-12-21 Thread Grant Edwards
On 2020-12-21, Chris Angelico  wrote:
> On Mon, Dec 21, 2020 at 1:11 PM Julio Di Egidio  wrote:
>> > Gathering evidence is indeed part of science, and computer science is
>> > indeed mathematics, but alas programmering is just a craft and software
>> > engineering often ... isn't.
>>
>> Programming is a *discipline*
>
> It's a discipline, a science, AND an art.

And a craft.

And a dessert topping!


-- 
https://mail.python.org/mailman/listinfo/python-list


Re: How do you find what exceptions a class can throw?

2020-12-21 Thread Terry Reedy

On 12/21/2020 4:06 AM, Chris Green wrote:

Avi Gross  wrote:

The original question sounded like someone was asking what errors might be
thrown for a routine they wrote that used other components that might
directly throw exceptions or called yet others, ad nauseum.


OP here.  The original question was because I wanted to trap timout
errors when connectiing to a POP3 server in a very simple little
program that collects mail and runs it through a filter before
delivering it.




Thus I simply needed to know what the 'name' of the exception was so I
could trap only timeouts.

...
> It didn't seem such a difficult question when I asked it! :-)


Please acknowledge that this is *not* what you asked.

"I am using poplib.POP3_SSL() and I want to know what exceptions can be 
thrown when I instantiate it. "


If you had just asked "What is the name of a possible timeout error" 
someone would have answered just that.


--
Terry Jan Reedy

--
https://mail.python.org/mailman/listinfo/python-list


Pickling issue.

2020-12-21 Thread Vincent Vande Vyvre

Hi,

I've an object that I want to serialise with pickle.
When I reload the object the attributes of this object are correctly 
fixed except one of these.


This attribute (value) define a simple string.

Example:
-
tag =  XmpTag('Xmp.dc.format', 'image/jpeg')
tag.key
'Xmp.dc.format'
tag.type
'MIMEType'
tag.value
'image/jpeg'

s = pickle.dumps(tag)
t = pickle.loads(s)
t.key
'Xmp.dc.format' # Correct
t.type
'MIMEType'  # Correct
t.value
('image', 'jpeg')   # Not correct
-

Tested with Python-3.8

An idea ?
--
https://mail.python.org/mailman/listinfo/python-list


Problem running Pygame Zero

2020-12-21 Thread peter walker
Hi

I hope you can help. I am trying to use pygame zero (working with my 10 year
old grandson) but it won't run anything ( I did have it running for a little
while now nothing).

Below are the results of:

1.  Installing pygame zero
2.  Running a listing (whatever I run I get the same result).
3.  Listing of the file I am running

I have tried more than one version of Python and get the same results except
on Python 3.9.0 and .1 when pygame won't even install.

Please give me some help, I don't know how to proceed.

Thanking you in advance.

Peter Walker

 

PS C:\Users\Peter\Dropbox\My PC (Peter-Desktop)\Documents\escape> pip
install pgzero

Collecting pgzero

  Using cached pgzero-1.2-py3-none-any.whl (69 kB)

Requirement already satisfied: pygame<2.0,>=1.9.2 in
c:\users\peter\appdata\local\programs\python\python38\lib\site-packages
(from pgzero) (1.9.6)

Requirement already satisfied: numpy in
c:\users\peter\appdata\local\programs\python\python38\lib\site-packages
(from pgzero) (1.19.4)

Installing collected packages: pgzero

Successfully installed pgzero-1.2

PS C:\Users\Peter\Dropbox\My PC (Peter-Desktop)\Documents\escape>

 

PS C:\Users\Peter\Dropbox\My PC (Peter-Desktop)\Documents\escape> pgzrun
test.py

** On entry to DGEBAL parameter number  3 had an illegal value

** On entry to DGEHRD  parameter number  2 had an illegal value

** On entry to DORGHR DORGQR parameter number  2 had an illegal value

** On entry to DHSEQR parameter number  4 had an illegal value

Traceback (most recent call last):

  File "c:\users\peter\appdata\local\programs\python\python38\lib\runpy.py",
line 194, in _run_module_as_main

return _run_code(code, main_globals, None,

  File "c:\users\peter\appdata\local\programs\python\python38\lib\runpy.py",
line 87, in _run_code

exec(code, run_globals)

  File
"C:\Users\Peter\AppData\Local\Programs\Python\Python38\Scripts\pgzrun.exe\__
main__.py", line 4, in 

  File
"c:\users\peter\appdata\local\programs\python\python38\lib\site-packages\pgz
ero\runner.py", line 1, in 

import pygame

  File
"c:\users\peter\appdata\local\programs\python\python38\lib\site-packages\pyg
ame\__init__.py", line 343, in 

import pygame.surfarray

  File
"c:\users\peter\appdata\local\programs\python\python38\lib\site-packages\pyg
ame\surfarray.py", line 64, in 

import pygame._numpysurfarray as numpysf

  File
"c:\users\peter\appdata\local\programs\python\python38\lib\site-packages\pyg
ame\_numpysurfarray.py", line 51, in 

import numpy

  File
"c:\users\peter\appdata\local\programs\python\python38\lib\site-packages\num
py\__init__.py", line 305, in 

_win_os_check()

  File
"c:\users\peter\appdata\local\programs\python\python38\lib\site-packages\num
py\__init__.py", line 302, in _win_os_check

raise RuntimeError(msg.format(__file__)) from None

RuntimeError: The current Numpy installation
('c:\\users\\peter\\appdata\\local\\programs\\python\\python38\\lib\\site-pa
ckages\\numpy\\__init__.py') fails to pass a sanity check due to a bug in
the windows runtime. See this issue for more information:
https://tinyurl.com/y3dm3h86

PS C:\Users\Peter\Dropbox\My PC (Peter-Desktop)\Documents\escape>

 

Test.py

print("Hello")

 

 

-- 
https://mail.python.org/mailman/listinfo/python-list


RE: How do you find what exceptions a class can throw?

2020-12-21 Thread Avi Gross via Python-list
I agree Chris, that your original question is quite to the point. But is it 
always?

If you do something that tries to read a file (such as opening a database to 
send queries) on a remote server, how many different things might time out for 
various reasons? Some may resolve if you keep trying and some attempts may make 
it worse if everybody is pounding away resulting in a denial of service attack 
scenario.

Some people dealing with situations come up with more detailed attempts such as 
choosing a random interval before trying again. Protocols like the Post Office 
Protocol often already have built-in techniques like that in the protocol and 
the timeout may be caused by something in your chain not being set to wait long 
enough. 

So your attempt to retry a few times may well work. I wonder if a backup method 
would be to switch to using IMAP as many mail archives now support a way to 
approach them using several such interfaces, albeit perhaps to different 
destinations and other changes. But hat is not a trivial change to use as just 
an alternate. Trying again may work, albeit trying 100 times per second may not 
help if a server is rebooting or is out of memory or file space or other 
resources ...

I will say that if your function calls A() which calls B() and so on and the 
timeout happens at any place long the way or even at Z() then it is quite 
possible you may not get a specific exception back. Z() may indeed send back a 
TIMEOUT1 exception but then E() may intercept it and return a GENERIC_FAILURE12 
exception. Then B() may retry a few times and finally return a I_GIVE_UP_TRY 
LATER123 exception. You likely are depending on a module you have no control 
over that uses other modules.

But in your case, it may indeed be that simple.

Just a thought. You can write some code that catches every possible exception 
then carefully logs all details, and then perhaps quits. If you run your code 
many times and even cause reasons for it to fail, you may develop some 
knowledge of some of the exceptions that make it through back to your call and 
then you can change your code to specifically handle only those you have some 
idea what to do about. As mentioned, you have traceback info that may help you 
figure out where the exceptions come from or even why.

Good luck.

-Original Message-
From: Python-list  On 
Behalf Of Chris Green
Sent: Monday, December 21, 2020 4:06 AM
To: python-list@python.org
Subject: Re: How do you find what exceptions a class can throw?

Avi Gross  wrote:
> The original question sounded like someone was asking what errors 
> might be thrown for a routine they wrote that used other components 
> that might directly throw exceptions or called yet others, ad nauseum.
> 
OP here.  The original question was because I wanted to trap timout errors when 
connectiing to a POP3 server in a very simple little program that collects mail 
and runs it through a filter before delivering it.

Thus I simply needed to know what the 'name' of the exception was so I could 
trap only timeouts.  Timeout errors are (probably) 'soft' errors which merit a 
retry, most other errors when trying to connect to a POP server would be 
unrecoverable (POP syntax, wrong name, wrong password, etc.).

It didn't seem such a difficult question when I asked it! :-)

--
Chris Green
·
--
https://mail.python.org/mailman/listinfo/python-list

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Pickling issue.

2020-12-21 Thread Bob Gailer
On Mon, Dec 21, 2020, 3:03 PM Vincent Vande Vyvre <
vincent.vande.vy...@telenet.be> wrote:

> Hi,
>
> I've an object that I want to serialise with pickle.
> When I reload the object the attributes of this object are correctly
> fixed except one of these.
>
> This attribute (value) define a simple string.
>
> Example:
> -
> tag =  XmpTag('Xmp.dc.form'image/jpeg')


I am not familiar with XmpTag. Where might I get the containing module?

tag.key
> 'Xmp.dc.format'
> tag.type
> 'MIMEType'
> tag.value
> 'image/jpeg'
>
> s = pickle.dumps(tag)
> t = pickle.loads(s)
> t.key
> 'Xmp.dc.format' # Correct
> t.type
> 'MIMEType'  # Correct
> t.value
> ('image', 'jpeg')   # Not correct
> -
>
> Tested with Python-3.8
>
> An idea ?
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list