ModuleNotFoundError: No module named 'certs.check' Python Error
ModuleNotFoundError: No module named 'certs.check' Python Error
我的文件夹结构如下
-->Certs (Folder)
--> check.crt
--->client.py
class Client:
def get_parameters(self):
client = pymongo.MongoClient(
"mongodb://" + constants.USER_NAME + ":" + constants.PWD + constants.server +certs.check )
print("Done")
c=Client()
c.get_parameters()
我遇到错误 'certs.check'
我试过了
from certs import *
import certs.check
请告诉我如何导入这个文件
对于 PY 文件:
请尝试以下步骤:
在 certs
文件夹中,添加一个名为 __init__.py
的空文件,并使 __init__.py
文件为空。
使用以下代码导入:
from certs import check
对于 IO 文件(不是 PY 文件):
尝试使用 open
:
with open('certs/check.crt') as f:
# do something with `f`.
对于MongoDB:
client = pymongo.MongoClient("mongodb://" + constants.USER_NAME + ":" + constants.PWD + constants.server + 'certs/check.crt')
我的文件夹结构如下
-->Certs (Folder)
--> check.crt
--->client.py
class Client:
def get_parameters(self):
client = pymongo.MongoClient(
"mongodb://" + constants.USER_NAME + ":" + constants.PWD + constants.server +certs.check )
print("Done")
c=Client()
c.get_parameters()
我遇到错误 'certs.check'
我试过了
from certs import *
import certs.check
请告诉我如何导入这个文件
对于 PY 文件:
请尝试以下步骤:
在
certs
文件夹中,添加一个名为__init__.py
的空文件,并使__init__.py
文件为空。使用以下代码导入:
from certs import check
对于 IO 文件(不是 PY 文件):
尝试使用 open
:
with open('certs/check.crt') as f:
# do something with `f`.
对于MongoDB:
client = pymongo.MongoClient("mongodb://" + constants.USER_NAME + ":" + constants.PWD + constants.server + 'certs/check.crt')