Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #95996

Re: No request in module urllib ?

Subject Re: No request in module urllib ?
References <55E8FA34.8060600@telenet.be> <CAPTjJmpAF3F=ZxgK4PV+fkpJKMmo_rs+Zvg1mBnypztLY8u2Kw@mail.gmail.com> <55E8FF47.409@telenet.be>
From MRAB <python@mrabarnett.plus.com>
Date 2015-09-04 03:41 +0100
Newsgroups comp.lang.python
Message-ID <mailman.116.1441334470.8327.python-list@python.org> (permalink)

Show all headers | View raw


On 2015-09-04 03:17, Vincent Vande Vyvre wrote:
> Le 04/09/2015 04:08, Chris Angelico a écrit :
>> On Fri, Sep 4, 2015 at 11:56 AM, Vincent Vande Vyvre
>> <vincent.vande.vyvre@telenet.be> wrote:
>>> Python 3.2.3 (default, Jun 18 2015, 21:46:42)
>>> [GCC 4.6.3] on linux2
>>> Type "help", "copyright", "credits" or "license" for more information.
>>>>>> import urllib
>>>>>> urllib.request.urlopen('http://example.org')
>>> Traceback (most recent call last):
>>>    File "<stdin>", line 1, in <module>
>>> AttributeError: 'module' object has no attribute 'request'
>>>
>>> Same error with Python 3.4.0
>> With packages, like this, you sometimes need to explicitly import the
>> piece you want. That way, the urllib module doesn't have to load
>> everything up just because you wanted one small part. Try this
>> instead:
>>
>> import urllib.request
>> urllib.request.urlopen('http://example.org')
>>
>> Hope that helps!
>>
>> ChrisA
> Thanks, that works with 3.4.0. No with 3.2.3
>
It works for me with Python 3.2.5 on Windows.

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: No request in module urllib ? MRAB <python@mrabarnett.plus.com> - 2015-09-04 03:41 +0100

csiph-web