Skip to content
This repository has been archived by the owner on Sep 3, 2022. It is now read-only.

Fix project_id from gcloud config in py3 #194

Merged
merged 1 commit into from
Feb 14, 2017

Commits on Feb 14, 2017

  1. Fix project_id from gcloud config in py3

    - `Popen.stdout` is a `bytes` in py3, needs `.decode()`
    
    - Before:
    ```py
    >>> %%sql -d standard
    ... select 3
    Your active configuration is: [test]
    
    HTTP request failed: Invalid project ID 'b'foo-bar''. Project IDs must contain 6-63 lowercase letters, digits, or dashes. IDs must start with a letter and may not end with a dash.
    ```
    ```sh
    $ for p in python2 python3; do $p -c 'from datalab.context._utils import get_project_id; print(get_project_id())'; done
    Your active configuration is: [test]
    
    foo-bar
    Your active configuration is: [test]
    
    b'foo-bar'
    ```
    
    - After:
    ```py
    >>> %%sql -d standard
    ... select 3
    Your active configuration is: [test]
    
    QueryResultsTable job_1_bZNbAUtk8QzlK7bqWD5fz7S5o
    ```
    ```sh
    $ for p in python2 python3; do $p -c 'from datalab.context._utils import get_project_id; print(get_project_id())'; done
    Your active configuration is: [test]
    
    foo-bar
    Your active configuration is: [test]
    
    foo-bar
    ```
    jdanbrown committed Feb 14, 2017
    Configuration menu
    Copy the full SHA
    6e9acd0 View commit details
    Browse the repository at this point in the history