Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby-on-rails-4/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
python中配置模块的查询_Python_Config - Fatal编程技术网

python中配置模块的查询

python中配置模块的查询,python,config,Python,Config,我正在分析一个旧框架,其中一个python文件在运行时给了我错误。下面是相同的代码 from config import Config CAPTURE_CONFIG = Config( name='CAPTURE_CONFIG', is_saved=True, is_modified=True) 错误: __init__() got an unexpected keyword argument 'is_modified' 我需要消除这个错误,如果有人可以指出,当我们可以在Config(fi

我正在分析一个旧框架,其中一个python文件在运行时给了我错误。下面是相同的代码

from config import Config

CAPTURE_CONFIG = Config(
name='CAPTURE_CONFIG',
is_saved=True,
is_modified=True)
错误:

__init__() got an unexpected keyword argument 'is_modified'

我需要消除这个错误,如果有人可以指出,当我们可以在Config(file)中传递一个文件时,需要在Config()本身定义变量。

这个错误非常清楚。此对象中没有
is\u modified
参数。拿出理由让它起作用

否则,您可以创建一个继承Config并指定
is\u modified
的类

要继承
Config
类,可以执行以下操作

class NewConfig(Config):
    def __init__(self, is_modified):
        super(NewConfig, self).__init__(is_modified)
        self.is_modified = is_modified

您可以在SO post和其他地方找到有关继承的更多信息。

此模块是什么?它是从哪里来的?@Bharel如果你能详细说明你关于创建一个类的答案,我想这是很有帮助的