【发布时间】:2019-06-26 14:25:30
【问题描述】:
对于我添加的 Python 文件:
from google.cloud.talent_v4beta1.types import RequestMetadata
from google.cloud.talent_v4beta1.types import JobView
from google.cloud.talent_v4beta1.types import SearchMode
pylint 接受所有三行。但是当我尝试导入 JobView 和/或 SearchMode 时,运行会产生 ImportError。
ImportError: cannot import name 'SearchMode' from 'google.cloud.talent_v4beta1.types
ImportError: cannot import name 'JobView' from 'google.cloud.talent_v4beta1.types
我也尝试过search_mode,但 pylint 抱怨,如果我尝试运行代码,我可以ImportError。
最终,这些值映射到字符串,所以我可以简单地添加 "JOB_SEARCH" 和 "JOB_VIEW_FULL",但我想使用 Google 的 API,因为它打算使用。我肯定还需要访问其他值。
【问题讨论】:
-
您是否已将这些库添加到您的项目中?类似于
pycharm中的this。您可能需要手动添加模块! -
是的,我已将 Google Cloud Talent Solution 库添加到我的项目中。我已经使用 API 添加和更新作业。现在我已经转移到搜索并遇到了这个简单的导入问题。请注意: from google.cloud.talent_v4beta1.types import RequestMetadata 确实可以证明我可以访问“类型”
标签: python google-cloud-talent-solution