IOError: [Errno 13] Permission denied: 'token.pickle'

オープン
#172 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
35/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
python

調査の方向性

The failure is in quickstart.py at the open('token.pickle', 'wb') call inside main(), reached after the OAuth browser flow completes. Check whether the script's working directory is writable, since the reporter installed packages with sudo and the file may be owned by root. The fix should either make the sample write the token somewhere it can write or document the directory requirement, and a run that saves token.pickle without the error shows it is done.

索引モデルが issue の本文から書いたものです。

説明

Expected Behavior

to print either:
print('No data found.')
else:
print('Name, Major:')

Actual Behavior

Opening in existing browser session.
Traceback (most recent call last):
  File "quickstart.py", line 55, in <module>
    main()
  File "quickstart.py", line 35, in main
    with open('token.pickle', 'wb') as token:
IOError: [Errno 13] Permission denied: 'token.pickle'

Steps to Reproduce the Problem

Following quickstart.py example:
https://developers.google.com/sheets/api/quickstart/python#troubleshooting

  1. created a new google sheet and save file
  2. clicked enable the Google Sheet API set up with default setting: desktop app - downloaded .json file and stored in the same folder as the quickstart.py
  3. ran 'sudo pip install --upgrade google-api-python-client google-auth-httplib2 google-auth-oauthlib'
Found existing installation: google-auth-httplib2 0.0.3
    Uninstalling google-auth-httplib2-0.0.3:
      Successfully uninstalled google-auth-httplib2-0.0.3
  Found existing installation: google-api-python-client 1.7.9
    Uninstalling google-api-python-client-1.7.9:
      Successfully uninstalled google-api-python-client-1.7.9
  Found existing installation: google-auth-oauthlib 0.4.0
    Uninstalling google-auth-oauthlib-0.4.0:
      Successfully uninstalled google-auth-oauthlib-0.4.0
Successfully installed google-api-python-client-1.10.0 google-auth-httplib2-0.0.4 google-auth-oauthlib-0.4.1
  1. changed quickstart.py Sheet ID to match that of my sheet I had set up
  2. run 'python quickstart.py'
  3. pops up a window to authorise
  4. choose user and click authorise
  5. returned to screen and throws the error:
Traceback (most recent call last):
  File "quickstart.py", line 55, in <module>
    main()
  File "quickstart.py", line 35, in main
    with open('token.pickle', 'wb') as token:
IOError: [Errno 13] Permission denied: 'token.pickle'

Specifications

  • Python version (Python 2.7.16)
  • OS:
    PRETTY_NAME="Raspbian GNU/Linux 10 (buster)"
    NAME="Raspbian GNU/Linux"
    VERSION_ID="10"
    VERSION="10 (buster)"
    VERSION_CODENAME=buster
    ID=raspbian
    ID_LIKE=debian
主要言語
Python
スター
1.4k
フォーク
917
平均マージ
3分
マージ済み PR(30日)
1

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

googleworkspace/python-samples のほかの issue

googleworkspace/python-samples の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。