rlou
rlou

Reputation: 536

ImportError: cannot import name 'IncompleteRead' - Windows

this questions seems to have been answered before but only seems to have occurred with linux.

my only import on my file is import http.client and the full error is as follows:

Error:  An error occurred while installing html!
Command "python setup.py egg_info" failed with error code 1 in 
C:\Users\Robert\AppData\Local\Temp\pip-install-nwrzaprg\html\

This is likely caused by a bug in html. Report this to its maintainers.

(online_email-fRueOS4x) C:\Users\Robert\Desktop\stevesjobs_email>python 
auth0.py
Traceback (most recent call last):
  File "auth0.py", line 1, in <module>
    import http.client
  File "c:\users\robert\appdata\local\programs\python\python36- 
   32\Lib\http\client.py", line 71, in <module>
    import email.parser
  File "C:\Users\Robert\Desktop\online_email\email.py", line 2, in 
<module>
    import requests
  File "C:\Users\Robert\.virtualenvs\online_email-fRueOS4x\lib\site- 
packages\requests\__init__.py", line 43, in <module>
import urllib3
  File "C:\Users\Robert\.virtualenvs\online_email-fRueOS4x\lib\site- 
packages\urllib3\__init__.py", line 8, in <module>
     from .connectionpool import (
  File "C:\Users\Robert\.virtualenvs\online_email-fRueOS4x\lib\site- 
packages\urllib3\connectionpool.py", line 11, in <module>
    from .exceptions import (
   File "C:\Users\Robert\.virtualenvs\online_email-fRueOS4x\lib\site- 
packages\urllib3\exceptions.py", line 2, in <module>
    from .packages.six.moves.http_client import (
ImportError: cannot import name 'IncompleteRead'

I am using pipenv. Something that may have caused this is that i recently install linux shell on my windows ten to work with Hyper. But this project i'm running from my standard windows shell.

I'm pretty lost with this. Any help would be appreciated!

Upvotes: 1

Views: 1319

Answers (1)

Antwane
Antwane

Reputation: 22608

You problem is probably that you have a file called email.py in your environment.

Traceback (most recent call last):
  File "auth0.py", line 1, in <module>
    import http.client
  File "c:\users\robert\appdata\local\programs\python\python36-32\Lib\http\client.py", line 71, in <module>
    import email.parser
  File "C:\Users\Robert\Desktop\online_email\email.py", line 2, in 
<module>

In auth0.py, you wrote

import http.client

and in your environment's http.client module, there is a

import email.parser

This should lead to importing email.parser module from python environment, but interpreter found a file called email.py in this location: C:\Users\Robert\Desktop\online_email\email.py. Since this file is loaded by python interpreter, you obtain the error you have. Fix your environment (PYTHONPATH) to ensure your custom library are loaded AFTER Python builtin libraries, or better, don't use email.py as name for your script ;)

Upvotes: 5

Related Questions