首页 > 解决方案 > 为什么我的代码给我一个“mystica.json not found”错误?

问题描述

我正在尝试从 json 文件加载一些变量,但找不到该文件。

我试过删除文件并重新制作,重命名它,然后移动文件,但都没有奏效。

def loadVar():
    with open('mystica.json') as read_file:
        variables = json.load(read_file)
        return variables

我希望它能够从中获取值mystica.json,但它给了我错误

FileNotFoundError:[Errno 2] 没有这样的文件或目录:'mystica.json'

标签: python

解决方案


推荐阅读