[英]How to import Cloudant module to manipulate existing documents via IBM cloud server less function python 3.9 actions?
I am new to Cloud SDK, and I tried to invoke the following action, but I get error : " stderr: ModuleNotFoundError: No module named 'cloudant'",.我是 Cloud SDK 的新手,我尝试调用以下操作,但出现错误:“stderr: ModuleNotFoundError: No module named 'cloudant'”。
NOTE :注意:
Console ==> IBM cloudant python 3.9 SDK: No module named 'cloudant'"控制台 ==> IBM cloudant python 3.9 SDK:没有名为“cloudant”的模块”
CLI ==> Python 3.86 : accepted the module without error CLI ==> Python 3.86:接受模块没有错误
Question :==> I need to know how to do it using the CLI.问题:==>我需要知道如何使用 CLI 来完成。
If you have a solution please let me know in time.如果有解决办法请及时告诉我。 Thank You!!.谢谢你!!。
from cloudant.client import Cloudant
import requests
import json
dict = {"COUCH_USERNAME": "--bluemix",
"IAM_API_KEY": "---bluemix"}
def main(dict):
client = Cloudant.iam(user_name=dict["COUCH_USERNAME"],
api_key=dict["IAM_API_KEY"],
connect=True)
my_database=client['reviews']
return my_database.json```
Yes I did.是的,我做到了。 I have used Python 3.7 and it works.我使用过 Python 3.7,它可以工作。 However, it is depreciated on IBM cloud但是,它在 IBM 云上已折旧
The Python cloudant
module is EOL and is replaced by the ibmcloudant
module . Python cloudant
模块已停产并被ibmcloudant
模块取代。
As per the Functions documentation the 3.9 runtime contains the new ibmcloudant
module.根据Functions 文档,3.9 运行时包含新的ibmcloudant
模块。
You should migrate your action code to use ibmcloudant
instead of cloudant
.您应该迁移您的操作代码以使用ibmcloudant
而不是cloudant
。 If you can't want to migrate your code then you could force it to use the 3.7 runtime with --kind python:3.7
or create a custom 3.9 runtime with the cloudant
module installed.如果您不想迁移您的代码,那么您可以强制它使用带有--kind python:3.7
的 3.7 运行时,或者创建一个安装了cloudant
模块的自定义 3.9 运行时。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.