TencentCloud / TencentCloud/tencentcloud-cls-sdk-python

安装之后会导致 tencentcloud-sdk-python 报错 AttributeError: module 'tencentcloud' has no attribute '__version__'

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

Nobody has claimed this yet.

Dominant language
Python
Stars
5
Forks
10
Avg merge
4d 49m
Merged PRs (30d)
2

Description

先安装 tencentcloud-sdk-python

pip install tencentcloud-sdk-python

然后安装 tencentcloud-cls-sdk-python

pip install tencentcloud-cls-sdk-python@https://github.com/TencentCloud/tencentcloud-cls-sdk-python/archive/refs/tags/v1.0.5.tar.gz

导入tencentcloud的某些模块会报错:

>>> import tencentcloud.common.abstract_client
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "venv/lib/python3.9/site-packages/tencentcloud/common/abstract_client.py", line 64, in <module>
    class AbstractClient(object):
  File ".venv/lib/python3.9/site-packages/tencentcloud/common/abstract_client.py", line 70, in AbstractClient
    _sdkVersion = 'SDK_PYTHON_%s' % tencentcloud.__version__
AttributeError: module 'tencentcloud' has no attribute '__version__'

因为共用了相同的模块名称 tencentcloud,这个项目的代码把 tencentcloud-sdk-python 的代码覆盖了。

Contributor guide

No contributing guide indexed for this repository

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

Reproduce the two installation commands and the import failure, then inspect tencentcloud/common/abstract_client.py where tencentcloud.version is accessed. Review the installed package layout and module-name overlap; the issue is done when both SDKs can be installed together and importing tencentcloud.common.abstract_client no longer raises AttributeError.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.