modxevil / google-cloud-sdk

Automatically exported from code.google.com/p/google-cloud-sdk
0 stars 0 forks source link

Crash on compute instances describe #509

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Issue running command [gcloud compute instances describe].

What steps will reproduce the problem?
>  gcloud compute instances describe   

I've tried locally and the hosted console with the same result.

What is the expected output? What do you see instead?

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

Please provide any additional information below.

Traceback (most recent call last):
  File "gcloud_main.py", line 169, in main
    gcloud_cli.Execute()
  File "calliope/cli.py", line 643, in Execute
    result = args.cmd_func(cli=self, args=args)
  File "calliope/backend.py", line 1403, in Run
    display.Displayer(command_instance, args, resources).Display()
  File "calliope/display.py", line 364, in Display
    self._resources, fmt, defaults=self._defaults, out=log.out)
  File "core/resource/resource_printer.py", line 238, in Print
    _PrintResources(resources, printer, single)
  File "core/resource/resource_printer.py", line 82, in _PrintResources
    printer.AddRecord(resources, delimit=False)
  File "core/resource/resource_printer_base.py", line 134, in AddRecord
    self._AddRecord(self._process_record(record), delimit)
  File "core/resource/yaml_printer.py", line 87, in _AddRecord
    record = self._UpdateTypesForOutput(record)
  File "core/resource/yaml_printer.py", line 76, in _UpdateTypesForOutput
    val[key] = self._UpdateTypesForOutput(val[key])
  File "core/resource/yaml_printer.py", line 76, in _UpdateTypesForOutput
    val[key] = self._UpdateTypesForOutput(val[key])
  File "core/resource/yaml_printer.py", line 72, in _UpdateTypesForOutput
    val[i] = self._UpdateTypesForOutput(val[i])
  File "core/resource/yaml_printer.py", line 76, in _UpdateTypesForOutput
    val[key] = self._UpdateTypesForOutput(val[key])
============================================ TRUNCATED INFORMATION (PLEASE 
CONSIDER INCLUDING) =============================================
File "core/resource/yaml_printer.py", line 69, in _UpdateTypesForOutput
    return YamlPrinter._LiteralString(val)
UnicodeEncodeError: 'ascii' codec can't encode character u'\u201c' in position 
398: ordinal not in range(128)

Installation information:

Google Cloud SDK [94.0.0]

Platform: [Mac OS X, x86_64]
Python Version: [2.7.11 |Anaconda 2.3.0 (x86_64)| (default, Dec  6 2015, 
18:57:58)  [GCC 4.2.1 (Apple Inc. build 5577)]]
Python Location: [/Users/mbishop/anaconda/bin/python2]
Site Packages: [Disabled]

Installation Root: [/Users/mbishop/google-cloud-sdk]
Installed Components:
  core: [2016.01.22]
  app-engine-python: [1.9.31]
  core-nix: [2015.11.24]
  kubectl: []
  gcloud: []
  gsutil-nix: [4.15]
  beta: [2016.01.12]
  gsutil: [4.16]
  bq: [2.0.18]
  alpha: [2016.01.12]
  bq-nix: [2.0.18]
  kubectl-darwin-x86_64: [1.1.4]

Cloud SDK on PATH: [True]

Installation Properties: [/Users/mbishop/google-cloud-sdk/properties]
User Config Directory: [/Users/mbishop/.config/gcloud]
User Properties: [/Users/mbishop/.config/gcloud/properties]
Current Workspace: [None]
Workspace Config Directory: [None]
Workspace Properties: [None]

Account: [mbishop@logitbot.com]
Project: [decisive-plasma-110201]

Current Properties:
  [core]
    project: [decisive-plasma-110201]
    account: [mbishop@logitbot.com]
    disable_usage_reporting: [True]
  [compute]
    region: [us-central1]
    zone: [us-central1-b]

Logs Directory: [/Users/mbishop/.config/gcloud/logs]
Last Log File: 
[/Users/mbishop/.config/gcloud/logs/2016.01.29/05.21.57.720319.log]
========================================== END TRUNCATED INFORMATION (PLEASE 
CONSIDER INCLUDING) ==========================================

Original issue reported on code.google.com by mbis...@logitbot.com on 29 Jan 2016 at 10:27

GoogleCodeExporter commented 8 years ago
Thanks for the report. I've opened an internal issue to track this.

Original comment by dlor...@google.com on 1 Feb 2016 at 4:39

GoogleCodeExporter commented 8 years ago
Also encountered this on Windows 10, likely due to an accented character in the 
CWD path.

Original comment by jes...@google.com on 2 Feb 2016 at 1:26

GoogleCodeExporter commented 8 years ago
Can you run again with --format=flattened and post the last few lines of 
standard output before the ERROR: message. Flattened flushes line by line to 
the terminal and it will give a clue to the key that has the encoding problem 
(the key that would print after the last one that displayed).

Original comment by gsfow...@google.com on 2 Feb 2016 at 4:18

GoogleCodeExporter commented 8 years ago
Sure:

TKE:~ mbishop$ gcloud compute instances describe console2 --format=flattened
canIpForward:                                True
cpuPlatform:                                 Intel Haswell
creationTimestamp:                           2016-01-29T02:02:18.329-08:00
description:
disks[0].autoDelete:                         True
disks[0].boot:                               True
disks[0].deviceName:                         console2
disks[0].index:                              0
disks[0].interface:                          SCSI
disks[0].kind:                               compute#attachedDisk
disks[0].mode:                               READ_WRITE
disks[0].source:                             
https://www.googleapis.com/compute/v1/projects/xxxxxxx/zones/us-central1-b/disks
/console2
disks[0].type:                               PERSISTENT
id:                                          xxxxxxxx
kind:                                        compute#instance
machineType:                                 
https://www.googleapis.com/compute/v1/projects/xxxxxxx1/zones/us-central1-b/mach
ineTypes/custom (6 vCPU, 16.00 GiB)
metadata.fingerprint:                        xxxxx
metadata.items[0].key:                       startup-script
ERROR: gcloud crashed (UnicodeEncodeError): 'ascii' codec can't encode 
character u'\u201c' in position 398: ordinal not in range(128)

Original comment by mbis...@logitbot.com on 2 Feb 2016 at 6:16

GoogleCodeExporter commented 8 years ago
Its a unicode char in the startup script: '“' == 'LEFT DOUBLE QUOTATION 
MARK'. It should probably be the plain old ASCII double quote '"'.

This is definitely a describe command unicode bug, but there may be another 
problem. 

Did you cut and paste the startup script from a web page? If its intended to be 
a shell or cmd.exe double quote character then the script may be running 
something other than intended.

Original comment by gsfow...@google.com on 2 Feb 2016 at 8:04

GoogleCodeExporter commented 8 years ago
Ahh, the startup script.  Yes, come to thinks of it I believe I did c&p from 
either an RTF doc or a web page, def somewhere that could have been non-ascii.  
I'll make sure it's all  ASCII and give it another go.

Thanks for the help, good catch!

Original comment by mbis...@logitbot.com on 2 Feb 2016 at 8:50

GoogleCodeExporter commented 8 years ago
Thanks for following up. Interesting that after we fix our encoding bug 
cut&oaste problems like this may be harder to detect.

Original comment by gsfow...@google.com on 2 Feb 2016 at 10:01

GoogleCodeExporter commented 8 years ago
May want to keep an undocumented flag to "un-fix" the bug to help find these 
guys in the future. :)

Original comment by mbis...@logitbot.com on 2 Feb 2016 at 10:15

GoogleCodeExporter commented 8 years ago
Yeah, unintended consequences of being correct. Once we release fixes for a few 
unicode decoding bugs I'll post a filter that can weed out bugs like this, no 
special flag required.

Original comment by gsfow...@google.com on 5 Feb 2016 at 2:38