2013-11-26 3 views
1

내가 명령 줄을 통해 구글의 빅 쿼리 도구를 사용하기 시작 했어를 .bigqueryrc 초기화 내가 명령이 여기버그 구성 파일

Welcome to BigQuery! This script will walk you through the 
process of initializing your .bigqueryrc configuration file. 

First, we need to set up your credentials if they do not 
already exist. 


****************************************************************** 
** No OAuth2 credentials found, beginning authorization process ** 
****************************************************************** 

Go to the following link in your browser: 

가 나타납니다이 출력을 제공

>bq init 

를 실행하려고 google apis에 대한 웹 URL, 처음 오류가 발생했습니다 : invalid_request. 두 번째로 내 Google 계정 중 하나를 연결하고 권한을 부여했습니다. 그것은 나에게 코드를 주었다. 이 코드를 작성하면 다음과 같이 출력됩니다.

You have encountered a bug in the BigQuery CLI. Google engineers monitor and 
answer questions on Stack Overflow, with the tag google-bigquery: 
http://stackoverflow.com/questions/ask?tags=google-bigquery 
Please include a brief description of the steps that led to this issue, as well 
as the following information: 

======================================== 
== Platform == 
    CPython:2.7.6:Windows-7-6.1.7601-SP1 
== bq version == 
    v2.0.17 
== Command line == 
    ['D:\\Python27\\scripts\\bq-script.py', 'init'] 
== UTC timestamp == 
    2013-11-26 14:09:11 
== Error trace == 
    File "build\bdist.win-amd64\egg\bq.py", line 783, in RunSafely 
    return_value = self.RunWithArgs(*args, **kwds) 
    File "build\bdist.win-amd64\egg\bq.py", line 2082, in RunWithArgs 
    client = Client.Get() 
    File "build\bdist.win-amd64\egg\bq.py", line 604, in Get 
    cls.client = Client.Create() 
    File "build\bdist.win-amd64\egg\bq.py", line 584, in Create 
    credentials = _GetCredentialsFromFlags() 
    File "build\bdist.win-amd64\egg\bq.py", line 390, in _GetCredentialsFromFlags 
    credentials = credentials_getter(storage) 
    File "build\bdist.win-amd64\egg\bq.py", line 330, in _GetCredentialsFromOAuthF 
low 
    credentials = oauth2client.tools.run(flow, storage) 
    File "build\bdist.win-amd64\egg\oauth2client\util.py", line 132, in positional 
_wrapper 
    return wrapped(*args, **kwargs) 
    File "build\bdist.win-amd64\egg\oauth2client\old_run.py", line 156, in run 
    storage.put(credential) 
    File "build\bdist.win-amd64\egg\oauth2client\client.py", line 325, in put 
    self.locked_put(credentials) 
    File "build\bdist.win-amd64\egg\oauth2client\file.py", line 111, in locked_put 

    self._create_file_if_needed() 
    File "build\bdist.win-amd64\egg\oauth2client\file.py", line 97, in _create_fil 
e_if_needed 
    open(self._filename, 'a+b').close() 
======================================== 

Unexpected exception in init operation: [Errno 2] No such file or directory: 
'%USERPROFILE%\\.bigquery.v2.token' 

실마리가 무엇입니까? 이제 init 명령을 다시 실행하려고하면 동일한 웹 URL이 다시 표시되지만 Invalid_request 오류가 계속 발생합니다.

어떻게해야합니까? 내가 링크하고 권한을 부여하려는 계정은 이미 Bigquery가 활성화 된 프로젝트에 연결됩니다.

감사합니다.

+0

보고서 Mauricio에게 감사드립니다. 이 문제를 재현하고 수정하는 데 도움이되는 Windows 7 설치에 대한 세부 정보를 제공 할 수 있습니까? HOME 및 USERPROFILE 환경은 무엇입니까? Windows는 USERPROFILE을 자동으로 설정해야하지만 어떤 이유로 든 그렇지 않을 수도 있습니다. (유니 코드 문자가 사용자의 프로파일 디렉토리 이름에 포함되어있는 Windows에서 올바르게 처리하는 것에 관한 Python 버그도 있습니다. 그렇다면 영향을 줄 수 있습니다. 그렇다면 아래의 내 게시물에서 첫 번째 해결 방법이 유용 할 것입니다.) –

+0

HOME 변수가 % USERPROFILE %로 설정되었지만 USERPROFILE 환경 변수가 없습니다. –

답변

2

Windows 구성과 Python의 "홈 디렉토리 찾기"(특히 os.path.expanduser ('~')) 사이의 문제가 발생했습니다.

감사의 말씀을드립니다. 이 문제에 대해 https://code.google.com/p/google-bigquery/issues/detail?id=55&thanks=55&ts=1385494081에 추적 버그를 제출했습니다. 여기

당신이 추구 할 수있는 아이디어의 주위에 일의 커플 :

먼저, 파일 BQ에 정확한 경로를 지정할 수 있습니다 사용할 필요가있다 : 당신의 bigqueryrc의 파일은,을 만들어

bq --bigqueryrc=<path to your settings file> --credential_file=<path to your credentials file> 

credential_file=<path to your credentials file> 

을 그리고 BQ이 bigqueryrc 파일을 사용하여 시작할 때마다 다음, 항상 당신의 rc 파일에 지정된 명령 줄 플래그를 적용하고 데리러 : 그것은이 라인을 추가 할 수 있습니다 올바른 증명서 파일. 이점 : 장기적으로는 입력하지 않아도됩니다.

둘째, Python과 Windows 사이의 문제를 해결할 수 있습니다.

파이썬의 expanduser 구현은 환경 변수 HOME과 환경 변수 USERPROFILE에 우선 순위를 부여합니다. 이러한 이유로 구성되지 않은 경우 사용자 디렉토리를 가리 키도록 설정할 수 있습니다.