Google Cloud SDK installation error: UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 197: ordinal not in range(128)

Deadly 提交于 2019-12-10 13:37:14

问题


Google Cloud SDK installation process is failing on my machine(MAC) and giving me following stack trace.

Traceback (most recent call last):
  File "/Users/ttn/Desktop/google-cloud-sdk/bin/bootstrapping/install.py", line 218, in <module>
    main()
  File "/Users/ttn/Desktop/google-cloud-sdk/bin/bootstrapping/install.py", line 203, in main
    sdk_root=bootstrapping.SDK_ROOT,
  File "/Users/ttn/Desktop/google-cloud-sdk/lib/googlecloudsdk/core/platforms_install.py", line 452, in UpdateRC
    completion_update, path_update, rc_path, sdk_root, host_os).Update()
  File "/Users/ttn/Desktop/google-cloud-sdk/lib/googlecloudsdk/core/platforms_install.py", line 214, in Update
    self.path, rc_contents, source_line=self._GetSourceLine())
  File "/Users/ttn/Desktop/google-cloud-sdk/lib/googlecloudsdk/core/platforms_install.py", line 167, in _GetRcContents
    filtered_contents=filtered_contents, line=line)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 197: ordinal not in range(128)

Here are few more details:

System's default python version

python -V
Python 3.6.1 :: Anaconda custom (x86_64)

Python version for Cloud SDK.

echo $CLOUDSDK_PYTHON
/usr/bin/python2.7

Checking gcloud command

gcloud
-bash: gcloud: command not found

Note: This question might seem as duplicate, but i tried few solution available on portal but nothing worked for me.


回答1:


There is an open pull request to address this issue linked below that fixes the issue. The issue was that one of the files contain non-ASCII characters which causes the the Google Cloud SDK installer to fail. The open() function in Python 2.7 doesn't allow for a specified encoding.

Fix:
All references with open() should be replaced with io.open(..., encoding='utf-8'). Once again check the pull request to see those changes.

Resources:
- https://github.com/google-cloud-sdk/google-cloud-sdk/pull/2/files



来源:https://stackoverflow.com/questions/50486322/google-cloud-sdk-installation-error-unicodedecodeerror-ascii-codec-cant-dec

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!