gsutil command crashes every time on Windows 10
Asked Answered
P

2

0

Whenever I run some gsutil command, for example gsutil components update, it exits with this error:

ERROR: gcloud crashed (LookupError): unknown encoding: cp65001

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

Running gloud info --diagnostics as it suggests also fails with the same error:

Network diagnostic detects and fixes local network connection issues.
Checking network connection...failed.
ERROR: gcloud crashed (LookupError): unknown encoding: cp65001

Does anybody know how to fix this?

I've tried setting PYTHONIOENCODING=UTF-8 (Python 2.7 : LookupError: unknown encoding: cp65001) but it didn't help, I think gsutil uses its own Python and it might be ignoring/resetting this variable.

Edit:

I'm using Powershell, it already has UTF-8 set as the encoding:

[Console]::OutputEncoding


BodyName          : utf-8
EncodingName      : Unicode (UTF-8)
HeaderName        : utf-8
WebName           : utf-8
WindowsCodePage   : 1200
IsBrowserDisplay  : True
IsBrowserSave     : True
IsMailNewsDisplay : True
IsMailNewsSave    : True
IsSingleByte      : False
EncoderFallback   : System.Text.EncoderReplacementFallback
DecoderFallback   : System.Text.DecoderReplacementFallback
IsReadOnly        : True
CodePage          : 65001
Pinnace answered 7/7, 2018 at 8:32 Comment(0)
P
1

Reinstalling the Cloud SDK with "Bundled Python" unchecked did the trick for me. I have Python 2.7 installed independently.

Pinnace answered 8/7, 2018 at 15:42 Comment(0)
A
0

Just run:

set PYTHONIOENCODING=UTF-8
Anaemia answered 3/11, 2020 at 21:19 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.