打开同目录下的文件

Fed*_*zzo 5 json file python-3.x

我的包中有一个__init__.py文件,我Database想从config.json同一目录中的配置文件 ( ) 中读取一些信息。

我试过这个代码:

with open("config.json", 'r') as json_data:
    data = json.load(json_data)
print(data)
Run Code Online (Sandbox Code Playgroud)

但我收到了这个错误:

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

错误在哪里?