Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH] scipts/autobuild-run: properly import urllib2.URLError
Date: Sat, 5 Jun 2021 23:05:48 +0200	[thread overview]
Message-ID: <20210605230548.5daa732c@windsurf> (raw)
In-Reply-To: <20210605210016.1157351-1-yann.morin.1998@free.fr>

On Sat,  5 Jun 2021 23:00:16 +0200
"Yann E. MORIN" <yann.morin.1998@free.fr> wrote:

> Commit 37766e9 (scripts/autobuild-run: add a retry loop to not fail on
> urllib URLError) introduced an import of URLError, but that raises
> exceptions in both python2 and python3:
> 
>     $ python2 -c 'import urllib2.URLError as URLError'
>     Traceback (most recent call last):
>       File "<string>", line 1, in <module>
>     ImportError: No module named URLError
> 
>     $ python3 -c 'import urllib.error.URLError as URLError'
>     Traceback (most recent call last):
>       File "<string>", line 1, in <module>
>     ModuleNotFoundError: No module named 'urllib.error.URLError'; 'urllib.error' is not a package
> 
> The working solution is to import from:
> 
>     $ python2 -c 'from urllib2 import URLError; raise URLError(None)'
>     Traceback (most recent call last):
>       File "<string>", line 1, in <module>
>     urllib2.URLError: <urlopen error None>
> 
>     $ python3 -c 'from urllib.error import URLError; raise URLError(None)'
>     Traceback (most recent call last):
>       File "<string>", line 1, in <module>
>     urllib.error.URLError: <urlopen error None>
> 
> Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
> Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>

Reviewed-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>

Thanks!

Thomas
-- 
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

  reply	other threads:[~2021-06-05 21:05 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-05 21:00 [Buildroot] [PATCH] scipts/autobuild-run: properly import urllib2.URLError Yann E. MORIN
2021-06-05 21:05 ` Thomas Petazzoni [this message]
2021-06-06  7:20   ` Yann E. MORIN

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210605230548.5daa732c@windsurf \
    --to=thomas.petazzoni@bootlin.com \
    --cc=buildroot@busybox.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox