Getting ImportError: No module named document for any cloudant import

894 Views Asked by At

I'm trying to use cloudant-python library in my application, but I'm not able to import the library itself as I'm getting ImportError: No module named document as soon as I try to import anything from cloudant context. Following are details:

  • Cloudant version: cloudant-2.6.1.dev0
  • Python version: Python 2.7.9
  • Example codes which are giving error:

from cloudant.document import Document

OR

from cloudant.client import Cloudant

OR

from cloudant import Cloudant

The error is as follows:

Traceback (most recent call last):
 File "<stdin>", line 1, in <module>
 File "cloudant.py", line 1, in <module>
  from cloudant.document import Document
ImportError: No module named document
1

There are 1 best solutions below

0
On

The problem solved as I corrected very silly mistake, I named my script file as cloudant.py so instead of looking for cloudant.__something__ in library package it was searching the same script file, duh!