5

I've an __init__.py file in my Database package and I would want to read some information from a configuration file (config.json) in the same directory.

I've tried this code:

with open("config.json", 'r') as json_data:
    data = json.load(json_data)
print(data)

but i got this error:

FileNotFoundError: [Errno 2] No such file or directory: 'config.json'

Where is the mistake?

Federico Cuozzo
  • 363
  • 1
  • 7
  • 20

0 Answers0