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


Groups > comp.lang.python > #75297

Re: NameError: name 'requests' is not defined ?

X-Received by 10.182.104.68 with SMTP id gc4mr15723803obb.40.1406521669721; Sun, 27 Jul 2014 21:27:49 -0700 (PDT)
X-Received by 10.50.21.4 with SMTP id r4mr470649ige.5.1406521669530; Sun, 27 Jul 2014 21:27:49 -0700 (PDT)
Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!h18no5470256igc.0!news-out.google.com!eg1ni10igc.0!nntp.google.com!h18no5470251igc.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail
Newsgroups comp.lang.python
Date Sun, 27 Jul 2014 21:27:49 -0700 (PDT)
In-Reply-To <mailman.12374.1406519536.18130.python-list@python.org>
Complaints-To groups-abuse@google.com
Injection-Info glegroupsg2000goo.googlegroups.com; posting-host=79.183.177.9; posting-account=uo-8fwoAAACKsFzFX78JHudx1V7WDXZ0
NNTP-Posting-Host 79.183.177.9
References <mailman.12374.1406519536.18130.python-list@python.org>
User-Agent G2/1.0
MIME-Version 1.0
Message-ID <fb1fff77-bac8-4f6a-b1ff-0eb014db9d99@googlegroups.com> (permalink)
Subject Re: NameError: name 'requests' is not defined ?
From Miki Tebeka <miki.tebeka@gmail.com>
Injection-Date Mon, 28 Jul 2014 04:27:49 +0000
Content-Type text/plain; charset=ISO-8859-1
Content-Transfer-Encoding quoted-printable
Xref csiph.com comp.lang.python:75297

Show key headers only | View raw


Greetings,

> there is only one line in mydown.py .
>  
> 
> import requests  
> ...
> >>> import mydown
> >>> requests.get(url)
> 
> Traceback (most recent call last):
> 
>   File "<stdin>", line 1, in <module>
> 
> NameError: name 'requests' is not defined
You need to call mydown.requests, but I think you're missing the point of modules and imports. I suggest you go over https://docs.python.org/3.4/tutorial/

HTH,
--
Miki

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


Thread

NameError: name 'requests' is not defined ? "水静流深" <1248283536@qq.com> - 2014-07-28 11:52 +0800
  Re: NameError: name 'requests' is not defined ? Miki Tebeka <miki.tebeka@gmail.com> - 2014-07-27 21:27 -0700
  Re: NameError: name 'requests' is not defined � Steven D'Aprano <steve@pearwood.info> - 2014-07-28 05:07 +0000

csiph-web