To solve import httplib ImportError: No module named httplib error follow below methods.
ERROR LOG
Traceback (most recent call last):
File "main.py", line 15, in <module>
import httplib
ImportError: No module named httplib
Contents
How to solve import httplib ImportError: No module named httplib ?
Refer the given methods to solve the issue.
Method 1:
You will generally get this error when you are running the Python2 code on Python3 environment. In Python 3, the module has been renamed to http.client
. Look at the documentation for clear details.
You may try running the 2to3
tool on your code and having it automatically translated. All references to httplib
will be modified to use http.client instead.
Method 2 :
Simply import http.client and rename it to httplib using the following code:
import http.client as httplib
Hope the above solution works.
Also read : PyCharm shows unresolved references error for valid code