Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.005 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'python,': 0.02; 'third- party': 0.04; 'error:': 0.07; 'importerror:': 0.07; 'skip:` 10': 0.07; 'urllib2': 0.07; 'wednesday,': 0.07; 'cc:addr:python-list': 0.11; 'python': 0.11; 'posted': 0.15; 'nowadays': 0.16; 'simplest': 0.16; 'folks': 0.16; 'wrote:': 0.18; 'module': 0.19; 'import': 0.22; 'email addr:gmail.com>': 0.22; 'cc:addr:python.org': 0.22; '2.x': 0.24; 'exists': 0.24; 'instead.': 0.24; 'cc:2**0': 0.24; "i've": 0.25; '15,': 0.26; 'skip:" 30': 0.26; 'header:In-Reply-To:1': 0.27; 'message- id:@mail.gmail.com': 0.30; "i'm": 0.30; 'file:': 0.31; 'produces': 0.31; 'file': 0.32; 'url:python': 0.33; '(most': 0.33; 'link.': 0.33; 'received:google.com': 0.35; 'everyone.': 0.36; 'url:org': 0.36; 'so,': 0.37; 'skip:& 10': 0.38; 'follows:': 0.38; 'recent': 0.39; 'ensure': 0.60; 'skip:u 10': 0.60; 'most': 0.60; 'today.': 0.61; 'new': 0.61; "you're": 0.61; 'times': 0.62; 'name': 0.63; 'fire': 0.65; 'to:addr:gmail.com': 0.65; 'here': 0.66; '8bit%:27': 0.74; '2014,': 0.84; 'sender:addr:chris': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rebertia.com; s=google; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=Jiq9gYsr+pzK8HJKlAqjVGQ12uqjHFRE25e9ZUfdoAM=; b=foUWUuP0jspeQNUuO834J5M7OVf2Qn+eOPerhuS+w5b1tY4QvG9wCow3hONhJwUwtW C9OeErsRkaf9yZHv0hu1GoY0yTk3n4PVmYUMC5PlQPUWYZ/kwjaehRLeWf0JWtmB3UtZ wLK4PsTTrov1jN/MVtwnbiETtXjf13jA+Cf40= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=Jiq9gYsr+pzK8HJKlAqjVGQ12uqjHFRE25e9ZUfdoAM=; b=T7fkWZ7DizFjWfB8Hn7Q5DESCn0slj8KLsBmiAQRqxsgzTEsmpVrIg3jz0oyh5PUzY jFfdzWiWsMbXOZu7Yyr/xRP+69HgUtTXu5rmhdo0xZKU7/5SBzaQzm7Qb/1Uly1y1hbH KBOFd2nAG/Kqp7DyjOu4lrfPPEI43GZeZAKogTBTE3zj66xn2Ludjr07mNB/B/1V4bm1 2YC5bnOlvNErjOB+v9ijgFEN8YEVKgTmeGIgBpVOxcUO7M3+TN2MnT7fBaBqcfKRbSfQ siMxG8YZamw7qo1Et9j6ZF+7/dZNlNa0wLf6qN7UI4x7sJyl0W4F30/fSGk3moMVNiX1 8DwQ== X-Gm-Message-State: ALoCoQkO8wDibWIJGP3Q82K7UMGal83whHnPvN8IjFsWP68GWv0U32xBBVhASnjLautny2l+sDXC MIME-Version: 1.0 X-Received: by 10.50.114.101 with SMTP id jf5mr18181821igb.23.1413422485460; Wed, 15 Oct 2014 18:21:25 -0700 (PDT) Sender: chris@rebertia.com In-Reply-To: <1a3844da-b467-43ba-b34f-3aaa6442d799@googlegroups.com> References: <1a3844da-b467-43ba-b34f-3aaa6442d799@googlegroups.com> Date: Wed, 15 Oct 2014 18:21:25 -0700 X-Google-Sender-Auth: gy_ZudRNK4B1oodzHIsb_cE1SKI Subject: Re: Import Doesn't Import From: Chris Rebert To: ryguy7272 Content-Type: multipart/alternative; boundary=047d7b41426829f8eb0505801123 Cc: "python-list@python.org" X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 96 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1413424210 news.xs4all.nl 2925 [2001:888:2000:d::a6]:39358 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:79196 --047d7b41426829f8eb0505801123 Content-Type: text/plain; charset=UTF-8 On Wednesday, October 15, 2014, ryguy7272 wrote: > So sorry everyone. I've posted here several times today. This is VERY > frustrating. > > So, I'm reading this link. > https://docs.python.org/2/howto/urllib2.html > > Important note!: The "/2/" in the URL means those docs are for Python 2.x When using Python 3, ensure that the docs you're consulting have a "/3/" in them instead. > Fetching URLs > The simplest way to use urllib2 is as follows: > import urllib2 > response = urllib2.urlopen('http://python.org/') > html = response.read() > > > So, I fire up Python, and create a new file and name it and hit F5. > > All I have is thins in the file: > import urllib2 > response = urllib2.urlopen('http://python.org/') > html = response.read() > > It immediately produces this error: > Traceback (most recent call last): > File "C:/Python34/import_web_data.py", line 1, in > import urllib2 > ImportError: No module named 'urllib2' > > You're using Python 3, and the urllib2 module no longer exists in Python 3. The URL/HTTP modules got refactored on Python 3. You want the `urllib.request` module instead. Although most folks nowadays use http://docs.python-requests.org/ instead, though it's third-party and outside the std lib. --047d7b41426829f8eb0505801123 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Wednesday, October 15, 2014, ryguy7272 <ryanshuell@gmail.com> wrote:
So sorry everyone.=C2=A0 I've posted here several times today.=C2= =A0 This is VERY frustrating.

So, I'm reading this link.
= https://docs.python.org/2/howto/urllib2.html=C2=A0


Important n= ote!: The "/2/" in the URL means those docs are for Python 2.xWhen using Python 3, ensure that the docs you're consulting have a &= quot;/3/" in them=C2=A0instead.
=C2=A0
Fetching URLs
The simplest way to use urllib2 is as follows:
import urllib2
response =3D urllib2.urlopen('http://python.org/')
html =3D response.read()


So, I fire up Python, and create a new file and name it and hit F5.

All I have is thins in the file:
import urllib2
response =3D urllib2.urlopen('http://python.org/')
html =3D response.read()

It immediately produces this error:
Traceback (most recent call last):
=C2=A0 File "C:/Python34/import_web_data.py", line 1, in <modu= le>
=C2=A0 =C2=A0 import urllib2
ImportError: No module named 'urllib2'


You're using Python 3, and the url= lib2 module no longer=C2=A0exists=C2=A0in=C2=A0Python 3. The URL/HTTP modul= es got refactored on Python 3. You want the `urllib.request` module instead= .
=C2=A0
Although most folks nowadays use=C2=A0http://docs.python-requests.org/=C2=A0i= nstead, though it's third-party and outside the std lib. --047d7b41426829f8eb0505801123--