Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #79196
| 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 | <chris@rebertia.com> |
| 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 <clp2@rebertia.com> |
| To | ryguy7272 <ryanshuell@gmail.com> |
| Content-Type | multipart/alternative; boundary=047d7b41426829f8eb0505801123 |
| Cc | "python-list@python.org" <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 <python-list.python.org> |
| List-Unsubscribe | <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.14909.1413424210.18130.python-list@python.org> (permalink) |
| 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 |
Show key headers only | View raw
[Multipart message — attachments visible in raw view] - view raw
On Wednesday, October 15, 2014, ryguy7272 <ryanshuell@gmail.com> 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 <module>
> 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.
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Import Doesn't Import ryguy7272 <ryanshuell@gmail.com> - 2014-10-15 17:40 -0700
Re: Import Doesn't Import ryguy7272 <ryanshuell@gmail.com> - 2014-10-15 17:44 -0700
Re: Import Doesn't Import Dan Stromberg <drsalists@gmail.com> - 2014-10-15 18:19 -0700
Re: Import Doesn't Import Terry Reedy <tjreedy@udel.edu> - 2014-10-15 22:43 -0400
Re: Import Doesn't Import Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-10-16 09:01 +0100
Re: Import Doesn't Import Chris Angelico <rosuav@gmail.com> - 2014-10-16 11:54 +1100
Re: Import Doesn't Import Dan Stromberg <drsalists@gmail.com> - 2014-10-15 18:12 -0700
Re: Import Doesn't Import MRAB <python@mrabarnett.plus.com> - 2014-10-16 02:13 +0100
Python 3 is the active language, recommended for newcomers (was: Import Doesn't Import) Ben Finney <ben+python@benfinney.id.au> - 2014-10-16 12:35 +1100
Re: Import Doesn't Import Chris Rebert <clp2@rebertia.com> - 2014-10-15 18:21 -0700
Re: Import Doesn't Import Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2014-10-15 22:11 -0400
Re: Import Doesn't Import Emile van Sebille <emile@fenx.com> - 2014-10-16 14:29 -0700
Re: Import Doesn't Import Joel Goldstick <joel.goldstick@gmail.com> - 2014-10-16 18:28 -0400
Re: Import Doesn't Import Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-10-16 23:56 +0100
csiph-web