pymongo 3.6.1抛出错误InvalidURI:空字符串不是有效的usernam

2024-09-28 01:30:06 发布

您现在位置:Python中文网/ 问答频道 /正文

我在PyMongo3.6.1中遇到了以下错误,3.6.0也有同样的问题,有人能为我提供指导,告诉你如何在PyMongo3.6.1中修复这个问题吗?在

在代码:-在

from pymongo import MongoClient
from bson.objectid import ObjectId
import os,pymongo
dbuser = os.environ.get('muser', '')
dbpass = os.environ.get('mpwd', '')
uri = 'mongodb://{dbuser}:{dbpass}@machine.company.com:27017/techautomation'.format(**locals())
client = MongoClient(uri)
db = client.techautomation

在错误:-在

^{pr2}$

Tags: 代码fromimportclientgetos错误environ

热门问题