"LookupError: unknown encoding: ascii" when starting bootstrap

I am using zc.buildout, and when I try to run bootstrap (for the first time on a new computer), I get the following error below:

>> python2.7 bootstrap.py Traceback (most recent call last): File "bootstrap.py", line 158, in <module> import pkg_resources File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/../../Extras/lib/python/pkg_resources.py", line 698, in <module> class Environment(object): File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/../../Extras/lib/python/pkg_resources.py", line 701, in Environment def __init__(self, search_path=None, platform=get_supported_platform(), python=PY_MAJOR): File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/../../Extras/lib/python/pkg_resources.py", line 99, in get_supported_platform plat = 'macosx-%s-%s' % ('.'.join(_macosx_vers()[:2]), m.group(3)) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/../../Extras/lib/python/pkg_resources.py", line 209, in _macosx_vers _cache.append(mac_ver()[0].split('.')) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/platform.py", line 803, in mac_ver File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/platform.py", line 780, in _mac_ver_xml File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plistlib.py", line 78, in readPlist File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plistlib.py", line 406, in parse File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plistlib.py", line 418, in handleEndElement File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plistlib.py", line 452, in end_key File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plistlib.py", line 436, in getData LookupError: unknown encoding: ascii 

Has anyone seen this before or knows how to fix it? This seems to be due to getting the current version of my operating system. My operating system is Mac 10.8.2.

Thanks!

+4
source share
4 answers

Ensure that /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7 contains uncompromised modules (* .py). By default, they are missing, and here is the problem.

+2
source

According to Vitaliy, the problem is that the source .py files are missing in /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ (there are only .pyc files in a clean installation). In particular, these files must exist to bootstrap.py download:

 /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/encodings/__init__.py /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site.py 

You can copy them from a virtual or from another computer.

+2
source

Installing Xcode command line tools solved the problem for me, although I cannot explain why. You can install them from Xcode under

 Preferences -> Downloads 

or on the Apple Developers page .

+2
source

This seems to be a problem only with Mountain Lion, and only if your python was installed fresh on it (or the reports seem to indicate).

Workaround - running python using the -S switch:

 python2.7 -S bootstrap.py 

or create virtualenv, then run bootstrap.py script with virtual python.

+1
source

Source: https://habr.com/ru/post/1446855/


All Articles