问题描述
我在使用Google Cloud Platform Translation API时遇到问题,我只想在将其用于数据集之前对其进行测试。我不断收到此错误:
InvalidArgument:400个无效的“父母”。无效的资源名称项目ID。标识符必须以字母开头。资源类型:位置
# -*- coding: utf-8 -*-
from google.cloud import translate_v3
os.environ['GOOGLE_APPLICATION_CREDENTIALS'] =
r"C:\Users\manu_\OneDrive\Desktop\translate\translationAPI\GoogleCloudKEY.json"
translate_client = translate_v3.TranslationServiceClient()
text = 'Hello,how are you ?'
target = 'ru'
parent = translate_client.location_path('[projects/{my_project_id}]','[projects/{albatrosscx}/locations/{asia-est1 (Taiwan)}]')
output = translate_client.translate_text(text,target,parent)
print(output)
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)