librelist archives

« back to archive

Error during flask installation on W7 (Solved)

Error during flask installation on W7 (Solved)

From:
Loïc Espern
Date:
2014-01-17 @ 16:33
Hello All,

I had an error during Flask installation on my Win7 laptop (python 2.7.6).
After investigation, it appears that this issue was not a flask problem,
but a python error.
The problem is solved now, but I send it in order to help if somebody who
encounter the same problem....

Here is the error returned by 'pip install flask'
------------------------------------------------------------
C:\Python27\Scripts\pip-script.py run on 01/17/14 15:10:12
Downloading/unpacking flask
  Getting page https://pypi.python.org/simple/flask/
  URLs to search for versions for flask:
  * https://pypi.python.org/simple/flask/
  Analyzing links from page https://pypi.python.org/simple/Flask/
    Found link

https://pypi.python.org/packages/source/F/Flask/Flask-0.1.tar.gz#md5=d0c458397c49114fa279716798ca80c8
 (from https://pypi.python.org/simple/Flask/), version: 0.1
    Found link

https://pypi.python.org/packages/source/F/Flask/Flask-0.10.1.tar.gz#md5=378670fe456957eb3c27ddaef60b2b24
 (from https://pypi.python.org/simple/Flask/), version: 0.10.1
    Found link

https://pypi.python.org/packages/source/F/Flask/Flask-0.10.tar.gz#md5=92bc6b6ebd37d3120c235430a0491a15
 (from https://pypi.python.org/simple/Flask/), version: 0.10
    Found link

https://pypi.python.org/packages/source/F/Flask/Flask-0.2.tar.gz#md5=6926822b17cc5c7baa7df9d22c9cf114
 (from https://pypi.python.org/simple/Flask/), version: 0.2
    Found link

https://pypi.python.org/packages/source/F/Flask/Flask-0.3.1.tar.gz#md5=22bde65fbbcd93c6509b9939817e3853
 (from https://pypi.python.org/simple/Flask/), version: 0.3.1
    Found link

https://pypi.python.org/packages/source/F/Flask/Flask-0.3.tar.gz#md5=5beb1e1b3c243d3ca078fe1ea9d6dbd8
 (from https://pypi.python.org/simple/Flask/), version: 0.3
    Found link

https://pypi.python.org/packages/source/F/Flask/Flask-0.4.tar.gz#md5=aec554ae684e7ff5895fd1b5c0dea378
 (from https://pypi.python.org/simple/Flask/), version: 0.4
    Found link

https://pypi.python.org/packages/source/F/Flask/Flask-0.5.1.tar.gz#md5=c54da4a640554eb616e4210f256199e6
 (from https://pypi.python.org/simple/Flask/), version: 0.5.1
    Found link

https://pypi.python.org/packages/source/F/Flask/Flask-0.5.2.tar.gz#md5=002b8ff41fa14d82662b1d7763f77855
 (from https://pypi.python.org/simple/Flask/), version: 0.5.2
    Found link

https://pypi.python.org/packages/source/F/Flask/Flask-0.5.tar.gz#md5=b5580ae05d75d80485c8694532f95910
 (from https://pypi.python.org/simple/Flask/), version: 0.5
    Found link

https://pypi.python.org/packages/source/F/Flask/Flask-0.6.1.tar.gz#md5=7af56e33fb6a35db2818c20e604c8698
 (from https://pypi.python.org/simple/Flask/), version: 0.6.1
    Found link

https://pypi.python.org/packages/source/F/Flask/Flask-0.6.tar.gz#md5=55a5222123978c8c16dae385724c0f3a
 (from https://pypi.python.org/simple/Flask/), version: 0.6
    Found link

https://pypi.python.org/packages/source/F/Flask/Flask-0.7.1.tar.gz#md5=4705d31035839dec320a1fd76ac2fa30
 (from https://pypi.python.org/simple/Flask/), version: 0.7.1
    Found link

https://pypi.python.org/packages/source/F/Flask/Flask-0.7.2.tar.gz#md5=a6f52d8de1f536ec982b363e4b6a0387
 (from https://pypi.python.org/simple/Flask/), version: 0.7.2
    Found link

https://pypi.python.org/packages/source/F/Flask/Flask-0.7.tar.gz#md5=1aaf5504ae28925fb97fb3ab8b85d3cd
 (from https://pypi.python.org/simple/Flask/), version: 0.7
    Found link

https://pypi.python.org/packages/source/F/Flask/Flask-0.8.1.tar.gz#md5=4b9e866bf43723d834b3ce8fcd13574d
 (from https://pypi.python.org/simple/Flask/), version: 0.8.1
    Found link

https://pypi.python.org/packages/source/F/Flask/Flask-0.8.tar.gz#md5=a5169306cfe49b3b369086f2a63816ab
 (from https://pypi.python.org/simple/Flask/), version: 0.8
    Found link

https://pypi.python.org/packages/source/F/Flask/Flask-0.9.tar.gz#md5=4a89ef2b3ab0f151f781182bd0cc8933
 (from https://pypi.python.org/simple/Flask/), version: 0.9
  Using version 0.10.1 (newest of versions: 0.10.1, 0.10, 0.9, 0.8.1, 0.8,
0.7.2, 0.7.1, 0.7, 0.6.1, 0.6, 0.5.2, 0.5.1, 0.5, 0.4, 0.3.1, 0.3, 0.2, 0.1)
  Downloading from URL

https://pypi.python.org/packages/source/F/Flask/Flask-0.10.1.tar.gz#md5=378670fe456957eb3c27ddaef60b2b24
 (from https://pypi.python.org/simple/Flask/)
  Running setup.py egg_info for package flask
    Traceback (most recent call last):
      File "<string>", line 3, in <module>
      File "build\bdist.win32\egg\setuptools\__init__.py", line 11, in
<module>
      File "build\bdist.win32\egg\setuptools\extension.py", line 5, in
<module>
      File "build\bdist.win32\egg\setuptools\dist.py", line 15, in <module>
      File "build\bdist.win32\egg\setuptools\compat.py", line 19, in
<module>
      File "C:\Python27\lib\SimpleHTTPServer.py", line 27, in <module>
        class
SimpleHTTPRequestHandler(BaseHTTPServer.BaseHTTPRequestHandler):
      File "C:\Python27\lib\SimpleHTTPServer.py", line 208, in
SimpleHTTPRequestHandler
        mimetypes.init() # try to read system mime.types
      File "C:\Python27\lib\mimetypes.py", line 358, in init
        db.read_windows_registry()
      File "C:\Python27\lib\mimetypes.py", line 258, in
read_windows_registry
        for subkeyname in enum_types(hkcr):
      File "C:\Python27\lib\mimetypes.py", line 249, in enum_types
        ctype = ctype.encode(default_encoding) # omit in 3.x!
    UnicodeDecodeError: 'ascii' codec can't decode byte 0xe9 in position
20: ordinal not in range(128)
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
  File "<string>", line 3, in <module>
  File "build\bdist.win32\egg\setuptools\__init__.py", line 11, in <module>
  File "build\bdist.win32\egg\setuptools\extension.py", line 5, in <module>
  File "build\bdist.win32\egg\setuptools\dist.py", line 15, in <module>
  File "build\bdist.win32\egg\setuptools\compat.py", line 19, in <module>
  File "C:\Python27\lib\SimpleHTTPServer.py", line 27, in <module>
    class SimpleHTTPRequestHandler(BaseHTTPServer.BaseHTTPRequestHandler):
  File "C:\Python27\lib\SimpleHTTPServer.py", line 208, in
SimpleHTTPRequestHandler
    mimetypes.init() # try to read system mime.types
  File "C:\Python27\lib\mimetypes.py", line 358, in init
    db.read_windows_registry()
  File "C:\Python27\lib\mimetypes.py", line 258, in read_windows_registry
    for subkeyname in enum_types(hkcr):
  File "C:\Python27\lib\mimetypes.py", line 249, in enum_types
    ctype = ctype.encode(default_encoding) # omit in 3.x!
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe9 in position 20:
ordinal not in range(128)
----------------------------------------

It seems that I have a non-ascii key in my registry which causes the problem
Looking at mimetypes.py line 249 :
----------------------------------------
try:
ctype = ctype.encode(default_encoding) # omit in 3.x!
except UnicodeEncodeError:
pass
----------------------------------------

I changed a little bit this code to print the bad non-ascii key in case of
 UnicodeDecodeError:
----------------------------------------
try:
ctype = ctype.encode(default_encoding) # omit in 3.x!
except UnicodeDecodeError:
print ctype
----------------------------------------

I deleted the non-ascii key, and everything worked

Regards