Instance of 'Resource' has no 'spreadsheets' member
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 15/100
Hướng nghiên cứu
The failing sample is the Google Sheets quickstart script (GSpread.py), and the traceback shows an ImportError for googleapiclient.discovery, so the first check is whether the interpreter VSCode runs has that package installed. The 'Resource has no spreadsheets member' message looks like an editor lint warning rather than a runtime failure. The issue has no linked fix and no agreed change, so it needs a maintainer decision on whether it is a sample bug or an environment question before any edit.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
I'm running Quickstart for Google Sheets APIv4 in VSCode and got the following error:
Instance of 'Resource' has no 'spreadsheets' member
and the following output:
[Running] python -u "./GSpread.py"
Traceback (most recent call last):
File "./GSpread.py", line 4, in <module>
from googleapiclient.discovery import build
ImportError: No module named googleapiclient.discovery
[Done] exited with code=1 in 0.092 seconds
Code (Quickstart for Google Sheets APIv4):
from __future__ import print_function
import pickle
import os.path
from googleapiclient.discovery import build
from google_auth_oauthlib.flow import InstalledAppFlow
from google.auth.transport.requests import Request
SCOPES = ['https://www.googleapis.com/auth/spreadsheets.readonly']
SAMPLE_SPREADSHEET_ID = '1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgvE2upms'
SAMPLE_RANGE_NAME = 'Class Data!A2:E'
def main():
creds = None
if os.path.exists('token.pickle'):
with open('token.pickle', 'rb') as token:
creds = pickle.load(token)
# If there are no (valid) credentials available, let the user log in.
if not creds or not creds.valid:
if creds and creds.expired and creds.refresh_token:
creds.refresh(Request())
else:
flow = InstalledAppFlow.from_client_secrets_file('credentials.json', SCOPES)
creds = flow.run_local_server(port=0)
with open('token.pickle', 'wb') as token:
pickle.dump(creds, token)
service = build('sheets', 'v4', credentials=creds)
sheet = service.spreadsheets()
result = sheet.values().get(spreadsheetId=SAMPLE_SPREADSHEET_ID,
range=SAMPLE_RANGE_NAME).execute()
values = result.get('values', [])
if not values:
print('No data found.')
else:
print('Name, Major:')
for row in values:
print('%s, %s' % (row[0], row[4]))
if __name__ == '__main__':
main()
Tried uninstalling/reinstalling/updating with:
pip3 install --upgrade google-api-python-client google-auth-httplib2 google-auth-oauthlib
Environment:
- VSCode version (1.42.1)
- Python version (3.81)
- OS (Mac)
Thanks!
- Ngôn ngữ chính
- Python
- Star
- 1.4k
- Fork
- 917
- Merge trung bình
- 3 phút
- Pull request đã merge (30 ngày)
- 1
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của googleworkspace/python-samples
-
ايقاف البحث الأمنCó thể làm lại được @sqrrrl đã nhận 400 ngày trước và không có pull request nào đang mở. Đang mở
googleworkspace/python-samples#2434 · 1 người được giao ·
-
Slow Uploads using Google Drive API with PythonCó thể làm lại được @sqrrrl đã nhận 740 ngày trước và không có pull request nào đang mở. Đang mở
googleworkspace/python-samples#1852 · 1 bình luận · 1 người được giao ·
-
403 error from google after a few successful runs of my codeCó thể làm lại được @vinay-google đã nhận 912 ngày trước và không có pull request nào đang mở. Đang mở
googleworkspace/python-samples#1424 · 1 người được giao ·
-
How to see the progress of files which is getting uploadedCó thể làm lại được @vinay-google đã nhận 928 ngày trước và không có pull request nào đang mở. Đang mở
googleworkspace/python-samples#1404 · 1 người được giao ·
-
Phyton SamplesCó thể làm lại được @PierrickVoulet đã nhận 975 ngày trước và không có pull request nào đang mở. Đang mở
googleworkspace/python-samples#1279 · 1 người được giao ·
Tất cả issue của googleworkspace/python-samples
Issue tương tự
-
[Bug]: HTTP 499 (Client Closed Request) is classified as a non-retryable format_error, so a mid-flight abort fails the turn over instead of retryingCó thể đã có người làm @yipinghuang1991 đã nhận hôm nay. Đang mởcomp/agent P2 type/bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
NousResearch/hermes-agent#156837 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Bug: Missing continue on ValueError in CpanBackend.check_feed causes UnboundLocalError or duplicate yieldsCó thể đã có người làm @muskan-creates352 đã nhận hôm nay. Đang mở
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 86/100
fedora-infra/anitya#2188 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
docs documentation need-triage SaaS
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
integration:hermes
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
vectorize-io/hindsight#6601 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
triage:product type:bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
dbt-labs/dbt-adapters#2333 ·
Maintainer thường phản hồi trong vòng 1 ngày