Getting started code throws error in notebook
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 1/5
- Thời gian dự kiến
- Dưới một giờ
- Mức phù hợp với người mới
- 45/100
- Loại issue
- Tài liệu
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- azure, python
- Lĩnh vực
- documentation
Hướng nghiên cứu
Cập nhật ví dụ Getting Started trong readme.md, tập trung vào vòng lặp trên get_projects_response quanh dòng 20. Xác minh rằng ví dụ notebook lặp đúng qua các project được trả về và không còn phát sinh AttributeError đã được báo cáo.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Running this code from the Getting Started section of the readme.md:
from azure.devops.connection import Connection
from msrest.authentication import BasicAuthentication
import pprint
# Fill in with your personal access token and org URL
personal_access_token = '**removed**'
organization_url = 'https://**notthedevdomain**.visualstudio.com/'
# Create a connection to the org
credentials = BasicAuthentication('', personal_access_token)
connection = Connection(base_url=organization_url, creds=credentials)
# Get a client (the "core" client provides access to projects, teams, etc)
core_client = connection.clients.get_core_client()
# Get the first page of projects
get_projects_response = core_client.get_projects()
index = 0
while get_projects_response is not None:
for project in get_projects_response.value:
pprint.pprint("[" + str(index) + "] " + project.name)
index += 1
if get_projects_response.continuation_token is not None and get_projects_response.continuation_token != "":
# Get the next page of projects
get_projects_response = core_client.get_projects(continuation_token=get_projects_response.continuation_token)
else:
# All projects have been retrieved
get_projects_response = None
Produces this error:
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
/tmp/ipykernel_19/1987585116.py in <cell line: 19>()
18 index = 0
19 while get_projects_response is not None:
---> 20 for project in get_projects_response.value:
21 pprint.pprint("[" + str(index) + "] " + project.name)
22 index += 1
AttributeError: 'list' object has no attribute 'value'
In this environment:
ArcGIS Notebooks
Server Information:
You are using Jupyter notebook.The version of the notebook server is: 6.4.12
The server is running on this version of Python:
Python 3.9.16 (main, Jan 11 2023, 16:05:54)
[GCC 11.2.0]Current Kernel Information:
Python 3.9.16 (main, Jan 11 2023, 16:05:54)
Type 'copyright', 'credits' or 'license' for more information
IPython 7.34.0 -- An enhanced Interactive Python. Type '?' for help.
To solve this error you have to remove the ".value" on get_projects_response on line 20.
while get_projects_response is not None:
for project in get_projects_response:
rather than the current:
while get_projects_response is not None:
for project in get_projects_response.value:
Would be cool if the readme.md could get updated to improve the onboarding experience for this package.
- Ngôn ngữ chính
- Python
- Star
- 684
- Fork
- 218
- Merge trung bình
- 8 ngày 10 giờ
- Pull request đã merge (30 ngày)
- 1
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
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 microsoft/azure-devops-python-api
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 55/100
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
-
README sample code has a bug Đang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 55/100
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 45/100
Tất cả issue của microsoft/azure-devops-python-api
Issue tương tự
-
link-check link-check:sphinx-theme
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
qgis/QGIS-Documentation#11275 ·
-
bug priority:normal ready-for-dev
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
OpenHands/extensions#626 · 1 bình luận ·
-
Change observation tooltip text Đang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 90/100
CSCfi/sd-search-api#39 ·
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 90/100