binbeobo / google-cloud-sdk

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

Not working when python points python3 #355

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Environment: Kubuntu 15.04

What steps will reproduce the problem?
$ sudo ln -s /usr/bin/python3 /usr/bin/python
$ gcloud info

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

Google Cloud SDK [0.9.83]

Platform: [Linux, x86_64]
Python Version: [2.7.9 (default, Apr  2 2015, 15:33:21)  [GCC 4.9.2]]
Site Packages: [Disabled]

Installation Root: [/home/phanect/google-cloud-sdk]
Installed Components:
  core: [2015.10.16]
  core-nix: [2015.09.03]
  kubectl: []
  gcloud: [2015.10.16]
  gsutil-nix: [4.14]
  gsutil: [4.15]
  bq: [2.0.18]
  alpha: [2015.10.08]
  kubectl-linux-x86_64: [1.0.6]
  bq-nix: [2.0.18]
System PATH: 
[/usr/bin:/home/phanect/.pyenv/libexec:/home/phanect/.pyenv/plugins/python-build
/bin:/home/phanect/.pyenv/plugins/pyenv-virtualenv/bin:/home/phanect/.pyenv/plug
ins/pyenv-update/bin:/home/phanect/.pyenv/plugins/pyenv-installer/bin:/home/phan
ect/.pyenv/plugins/pyenv-doctor/bin:/home/phanect/google-cloud-sdk/bin:/home/pha
nect/.gvm/bin:/home/phanect/.pyenv/shims:/home/phanect/.pyenv/bin:/usr/local/her
oku/bin:/home/phanect/.nvm/versions/node/v4.2.1/bin:/home/phanect/google-cloud-s
dk/bin:/home/phanect/.gvm/bin:/home/phanect/.pyenv/shims:/home/phanect/.pyenv/bi
n:/usr/local/heroku/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:
/bin:/usr/games:/usr/local/games]
Cloud SDK on PATH: [True]

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

Account: [phanective@gmail.com]
Project: [notelcrm]

Current Properties:
  [core]
    project: [notelcrm]
    account: [phanective@gmail.com]
    disable_usage_reporting: [False]
  [app]
    use_appengine_api: [True]
  [compute]
    region: [asia-east1]
    zone: [asia-east1-b]

Logs Directory: [/home/phanect/.config/gcloud/logs]
Last Log File: 
[/home/phanect/.config/gcloud/logs/2015.10.29/14.59.23.295088.log]

Actual:

Traceback (most recent call last):
  File "/home/phanect/google-cloud-sdk/lib/enum/__init__.py", line 364, in __getattr__
    return cls._member_map_[name]
KeyError: '_convert'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/phanect/google-cloud-sdk/./lib/googlecloudsdk/gcloud/gcloud.py", line 12, in <module>
    import signal
  File "/home/phanect/.pyenv/versions/3.5.0/lib/python3.5/signal.py", line 8, in <module>
    _IntEnum._convert(
  File "/home/phanect/google-cloud-sdk/lib/enum/__init__.py", line 366, in __getattr__
    raise AttributeError(name)
AttributeError: _convert

What is the output of 'gcloud info'?
See above

Please provide any additional information below.
This happens because gcloud runs Python code with `python` command, although it 
is incompatible with Python 3.
In environments which `python` points `python3` like mine, above error occurs.

As a workaround, I modified google-cloud-sdk/bin/gcloud.
Following my patch:

--- google-cloud-sdk/bin/gcloud 2015-10-29 14:59:47.357184624 +0900
+++ google-cloud-sdk/bin/gcloud.workaround 2015-10-29 15:04:57.156222811 +0900
@@ -62,7 +62,7 @@

 # if CLOUDSDK_PYTHON is not empty
 [ -z "$CLOUDSDK_PYTHON" ] &&
-  CLOUDSDK_PYTHON=python
+  CLOUDSDK_PYTHON=python2

 # if CLOUDSDK_PYTHON_SITEPACKAGES and VIRTUAL_ENV are empty
 case :$CLOUDSDK_PYTHON_SITEPACKAGES:$VIRTUAL_ENV: in

Original issue reported on code.google.com by phanect...@gmail.com on 29 Oct 2015 at 6:06

GoogleCodeExporter commented 8 years ago
Thanks for the report and workaround.

Original comment by gsfow...@google.com on 3 Nov 2015 at 8:41

GoogleCodeExporter commented 8 years ago
This issue also happen in gsutil.
The workaround is the same.

Original comment by phanect...@gmail.com on 3 Nov 2015 at 11:02

GoogleCodeExporter commented 8 years ago
Thanks. All of our shell wrapper scripts are generated with a common preamble. 
Fixing the preamble will ripple down to all of the wrappers at build time.

Original comment by gsfow...@google.com on 4 Nov 2015 at 2:02

GoogleCodeExporter commented 8 years ago
Sorry for the silence here--this has been fixed for a couple of releases.

Original comment by z...@google.com on 4 Jan 2016 at 2:04

GoogleCodeExporter commented 8 years ago
Thanks!

Original comment by phanect...@gmail.com on 4 Jan 2016 at 2:40