0

出現一個相當奇怪的問題 - 將在Windows 8.1上安裝了gsutil與Python 2.7.10進行主動(並正在工作)安裝的硬盤成像後,將其啓動在同一臺機器上運行,現在每次嘗試使用gsutil運行命令時,都會收到錯誤「Failure:invalid_grant」。gsutil在映像硬盤後在Windows上出現「失敗:無效授權」

下面是錯誤的全文:

C:\Windows\system32>c:\Python27\python.exe c:\gsutil\gsutil ls gs://twinpreviews 

INFO 1021 00:52:48.415000 multistore_file.py] Error decoding credential, skippin 
g 
Traceback (most recent call last): 
    File "c:\gsutil\third_party\oauth2client\oauth2client\multistore_file.py", lin 
e 381, in _refresh_data_cache 
    (key, credential) = self._decode_credential_from_json(cred_entry) 
    File "c:\gsutil\third_party\oauth2client\oauth2client\multistore_file.py", lin 
e 400, in _decode_credential_from_json 
    credential = Credentials.new_from_json(json.dumps(cred_entry['credential'])) 

    File "c:\gsutil\third_party\oauth2client\oauth2client\client.py", line 292, in 
new_from_json 
    return from_json(s) 
    File "c:\gsutil\third_party\gcs-oauth2-boto-plugin\gcs_oauth2_boto_plugin\oaut 
h2_client.py", line 465, in from_json 
    data['token_expiry'], EXPIRY_FORMAT) 
TypeError: must be string, not None 
Failure: invalid_grant. 

我已經嘗試重新運行配置多次 - 請注意,此錯誤只與一個服務賬戶停留,如果我使用不會發生基於瀏覽器的認證。

我也試圖刪除我的主目錄中的.boto文件,以及我的主目錄中的.gsutil文件夾,然後重新運行gsutil config -e多次無濟於事。

我也創建了一組新的憑據並嘗試了一個新的.json密鑰文件,但仍然沒有成功。

有什麼建議嗎?希望這裏的某個人遇到同樣的問題並找到了解決方案。謝謝!

+0

它看起來仍然有一些陳舊的文件試圖由multistore_file.py加載。如果使用調試標誌(gsutil -D ls ...)運行命令,應該希望能夠在輸出中看到文件名,然後可以刪除該文件。 –

+0

解決了問題!原來機器上的時鐘已關閉(未來幾天),顯然,當設置訪問密鑰過期時間時,gsutil不會對此留意。非常失望的發現這是問題,但很高興現在已經解決了。 –

+0

訪問密鑰到期時間由服務設置,而不是由gsutil設置。不過,如果gsutil可以在過期令牌的情況下提供更好的錯誤消息,那將會很好。我創建了https://github.com/GoogleCloudPlatform/gsutil/issues/307來跟蹤此問題。 –

回答

0

解決了問題!

原來機器上的系統時鐘已關閉(未來幾天),顯然gsutil在設置訪問密鑰過期時間時不會注意這一點。

非常令人失望,發現這是問題,但很高興現在解決了。