NameError: name 'requests' is not defined ？
steve at pearwood.info
Mon Jul 28 07:07:44 CEST 2014
On Mon, 28 Jul 2014 11:52:03 +0800, 水静流深 wrote:
> there is a simple file `mydown.py` saved in
> there is only one line in mydown.py .
> import requests
Just because mydown has imported requests, doesn't mean it is visible
everywhere. Each module is a separate namespace, so that
requests = "something"
inside module A doesn't break
inside module B.
Inside mydown you import requests, but you still need to import it in the
interactive interpreter too. Don't worry, the second import will be very
fast, once a module is imported once the second and subsequent times is
More information about the Python-list