aliyun / aliyun/aliyun-openapi-python-sdk

code example运行出错

Open
#480 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
1k
Forks
578
PR merge metrics
No merged PRs in 30d

Description

# -*- coding: utf8 -*-

from aliyunsdkcore.client import AcsClient
from aliyunsdkcore.acs_exception.exceptions import ClientException
from aliyunsdkcore.acs_exception.exceptions import ServerException
from aliyunsdkecs.request.v20140526 import DescribeInstancesRequest
from aliyunsdkecs.request.v20140526 import StopInstanceRequest

# Initialize AcsClient instance
client = AcsClient(
  "<your-access-key-id>",
  "<your-access-key-secret>",
  "<your-region-id>"
)

# Initialize a request and set parameters
request = DescribeInstancesRequest.DescribeInstancesRequest()
request.set_PageSize(10)

# Print response
response = client.do_action_with_exception(request)
print response


python3 test.py 
  File "test.py", line 22
    print response
          ^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(response)?

需要修改成print(response)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Python code example shown in the issue, especially line 22 in test.py, and compare its syntax with the Python 3 command used to run it. Confirm the example executes under Python 3 and that the corrected output statement removes the reported SyntaxError.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.