2to3 urllib.URLopener -> urllib.request.URLopener

Terry Reedy tjreedy at udel.edu
Mon Nov 1 21:30:30 CET 2010

On 11/1/2010 7:23 AM, Chris McDonald wrote:
> Howdy,
> I was going through, evaluating how hard a project would be to move
> over to a hybrid codebase of python2 and python3 using 2to3. I found
> that while it would convert most other urllib renames and moves, 2to3
> currently leaves urllib.URLopener as is, instead of changing it to go
> via the request module.
> Not sure if this is a bug or intended, so thought I'd bring it up to the list.

Good catch. Bug. Thanks for reporting.

Lib/lib2to3/fixes/fix_urllib.py has (near the top)
MAPPING = {'urllib':  [
                     ['URLOpener', 'FancyURLOpener', 'urlretrieve',

I reported the double misspelling of 'opener' as 'Opener' in

You can fix your local copy now. Good luck with the conversion.

Terry Jan Reedy

More information about the Python-list mailing list