Reputation: 129
I have a folder strcture as
-->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()
I am getting an error 'certs.check'
I have tried
from certs import *
import certs.check
Please tell me how to import this file
Upvotes: 1
Views: 144
Reputation: 71610
Try the following steps:
In the certs
folder, add an empty file named __init__.py
, and make the __init__.py
file empty.
Import with the following code:
from certs import check
Try using open
:
with open('certs/check.crt') as f:
# do something with `f`.
client = pymongo.MongoClient("mongodb://" + constants.USER_NAME + ":" + constants.PWD + constants.server + 'certs/check.crt')
Upvotes: 1