通过python运行时记录器错误

时间:2016-06-28 09:42:56

标签: python

我有一个python脚本,它接受几个命令行参数并执行一个函数。当我从shell运行它时它运行得很好

$ ./test.py arg1 arg2 arg3

但是当我通过另一个python函数调用它时会抛出错误

os.system("./test.py arg1 arg2 arg3")

这会抛出错误

Traceback (most recent call last):
  File "/var/redshift/PROJ/query/test.py", line 4, in <module>
    from new_main_queryAndProcess import main_queryAndProcess
  File "/var/redshift/PROJ/query/new_main_queryAndProcess.py", line 7, in <module>
    import mdr_lib as mdr
  File "/var/redshift/PROJ/query/mdr_lib.py", line 26, in <module>
    logging.config.fileConfig('logging.conf')
  File "/usr/lib/python3.4/logging/config.py", line 76, in fileConfig
    formatters = _create_formatters(cp)
  File "/usr/lib/python3.4/logging/config.py", line 109, in _create_formatters
    flist = cp["formatters"]["keys"]
  File "/usr/lib/python3.4/configparser.py", line 937, in __getitem__
    raise KeyError(key)
KeyError: 'formatters'
256

0 个答案:

没有答案