By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,814 Members | 1,050 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,814 IT Pros & Developers. It's quick & easy.

Can't find urllib2 or urlretrieve in Pythin 3.1.2

P: n/a
I have installed Python 3.1.2 on a Windows 7 64-bit VM. When I attempt to import urllib2 it fails with the error:

ImportError: No module named urllib2

I tried using urllib.urlretrieve but that also doesn't exist:

AttributeError: 'module' object has no attribute 'urlretrieve'

I tried re-installing Python and still get the above errors.

This all works on my non-VM Windows 7 machine.

Any ideas?

Many thanks.
Oct 14 '10 #1
Share this Question
Share on Google+
2 Replies


P: n/a
FYI: I worked around this by importing urllib.request and calling urllib.request.urlretrieve().
Oct 14 '10 #2

bvdet
Expert Mod 2.5K+
P: 2,851
Kevin,

The following statement is from python.org and explains why you could not import urllib2:

Note:
The urllib2 module has been split across several modules in Python 3.0 named urllib.request and urllib.error. The 2to3 tool will automatically adapt imports when converting your sources to 3.0.
Oct 14 '10 #3

Post your reply

Sign in to post your reply or Sign up for a free account.