MLSC
MLSC

Reputation: 5972

ImportError: No module named bingsearch

I have a script like:

#!/usr/bin/env python
import bingsearch
bingsearch.API_KEY='Your-Api-Key-Here'
r = bingsearch.request("Python Software Foundation")
r.status_code

and also:

$which python
/usr/bin/python

But when I copy script into bingsearch directory that I downloaded it works..

Should I set path? how?

Why do I have this error? Could you possibly help me?

Thank you

Upvotes: 0

Views: 74

Answers (1)

Pavan Gupta
Pavan Gupta

Reputation: 19243

The part of the import procedure that most programmers will need to care about is usually the first—locating the file to be imported (the “find it” part). Because you may need to tell Python where to look to find files to import, you need to know how to tap into its search path in order to extend it.

The Module Search Path Order

  1. The home directory of the program
  2. PYTHONPATH directories (if set)
  3. Standard library directories
  4. The contents of any .pth files (if present)
  5. The site-packages home of third-party extensions

For editing PYTHONPATH please check here

Upvotes: 1

Related Questions