5

Welcome to the Google Cloud SDK! Run "gcloud -h" to get the list of

available commands.

C:\Program Files (x86)\Google\Cloud SDK>gcloud init Welcome! This command will take you through the configuration of gcloud.

Your current configuration has been set to: [default]

You can skip diagnostics next time by using the following flag:
gcloud init --skip-diagnostics

Network diagnostic detects and fixes local network connection issues. Checking network connection...done. Reachability Check passed. Network diagnostic (1/1 checks) passed.

ERROR: gcloud crashed (UnicodeEncodeError): 'ascii' codec can't encode character u'\xe7' in position 13: ordinal not in range(128)

If you would like to report this issue, please run the following command: gcloud feedback

To check gcloud for common problems, please run the following command: gcloud info --run-diagnostics

I don't know what to do... I just want to use the sdk but I can't init it...

2
  • Can you look in your logs to see what might have gone wrong? The location of the logs directory can be found by running gcloud info. Running gcloud init is a good way to get your Cloud SDK set up for use. However it is not required, you can use the Cloud SDK without it. You will just have to set up your account using gcloud auth login and your project using gcloud config set project NAME_OF_YOUR_PROJECT.
    – Vilas
    Commented Jul 18, 2017 at 19:10
  • Thank you for your answer, there is the log : 1drv.ms/u/s!Al4u8hoba_q0m4d3Wx0SHWemeCjWEQ I guess the error is due to the 'ç' in my firstname ... but how to make it works then ? Commented Jul 30, 2017 at 14:46

6 Answers 6

9

Have a look at the file which gave error , edit the .py file to add following lines

import sys
reload(sys)
sys.setdefaultencoding('utf8')
3

Try edit the code in google-cloud-sdk/lib/third_party/socks/__init__.py(google-cloud-sdk is the archive you downloaded to install google cloud sdk) in line 262:

req = req + struct.pack(">H", destport)

to

if isinstance(req, unicode):
    req = req.encode('UTF-8')
req = req + struct.pack(">H", destport)

reference: https://c11e.wodemo.com/gcloud-crashed-unicodedecodeerror

2

For me the fix was removing an accent ('é') from a folder in the path of my project. Hope it can help someone since I didn't find this solution after googling it for hours.

1
  • This is the correct solution. I also had a special character in my project name. Thank you
    – Bögözi
    Commented Nov 10, 2019 at 7:36
1

I kept getting this similar error every time I ran a gcloud command after a crash:

ERROR: gcloud crashed (UnicodeDecodeError): 'utf8' codec can't decode byte 0xa4 in position 1: invalid start byte

The solution was to delete this file:

~/.config/gcloud/gce

Don't ask me why that works or what that files does, I don't know (if you do, please let me know), but it gets recreated on the next command run and it fixed my issue.

0
1

In my case, it was a special character in the folders of the current directory. After changing the current directory, it worked!

0

As you’ve noticed that the error is due to a non-ASCII character in the username. As a workaround, you can set the CLOUDSDK_CONFIG environment variable to a path that contains only ASCII characters.

1
  • that's right, I've set CLOUDSDK_CONFIG to C:\config and initialized gcloud
    – vladkras
    Commented Nov 19, 2017 at 19:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.