Python中文
首页
教程
问答
标签
搜索
登录
注册
Python 2.4.3:ConfigParser.NoSectionError:没有节:“格式化程序”
回答此问题可获得
20
贡献值,回答如果被采纳可获得
50
分。
<p>尝试使用日志配置文件来实现<code>TimedRotatinigFileHandler</code>。</p> <p>只是因为某些原因不接受配置文件。</p> <p>任何建议都很感激。</p> <hr/> <p>x.py公司:</p> <pre><code>import logging import logging.config import logging.handlers logging.config.fileConfig("x.ini") MyLog = logging.getLogger('x') MyLog.debug('Starting') </code></pre> <hr/> <p>x.ini:</p> <pre><code>[loggers] keys=root [logger_root] level=NOTSET handlers=trfhand [handlers] keys=trfhand [handler_trfhand] class=handlers.TimedRotatingFileHandler when=M interval=1 backupCount=11 formatter=generic level=DEBUG args=('/var/log/x.log',) [formatters] keys=generic [formatter_generic] class=logging.Formatter format=%(asctime)s %(levelname)s %(message)s datefmt= </code></pre> <hr/> <pre><code>Traceback (most recent call last): File "x.py", line 5, in ? logging.config.fileConfig("x.ini") File "/usr/lib/python2.4/logging/config.py", line 76, in fileConfig flist = cp.get("formatters", "keys") File "/usr/lib/python2.4/ConfigParser.py", line 511, in get raise NoSectionError(section) ConfigParser.NoSectionError: No section: 'formatters' </code></pre> <p>谢谢</p>
0 条评论
分类:
Python问答
请先
登录
后评论
默认排序
时间排序
1 个回答
匿名
1天前
擅长:python、mysql、java
<p>这个错误信息严格来说是准确的,但有误导性。</p> <p>“格式化程序”部分丢失的原因是日志模块找不到您传递给<code>logging.config.fileConfig</code>的文件。</p> <p>尝试使用绝对文件路径。</p>
请先
登录
后评论
针对此问题:
更多的回答
关注
89
关注
收藏
1
收藏,
216
浏览
网友 提问于 2天前
相关Python问题
pyVISA GPIB GET(组执行触发器)
6 回答
Pyvisa IOerror设备:Korad K3005d电源
8 回答
PyVISA mac OS X(山狮)安捷伦33250
10 回答
Pyvisa Pyusb无法加载大于1 MB的序列
2 回答
pyVisa RS232太慢
4 回答
PyVISA RS232超时错误(安捷伦电源)
5 回答
PyVISA SCPI命令和查询(值更新问题)
10 回答
PyVISA SerialInstrument需要硬重置才能在故障后连接
3 回答
pyvisa,未找到函数viOpen
6 回答
pyVISA:以编程方式将仪器返回到本地模式
6 回答
pyvisa:接口类型是什么意思?
3 回答
pyvisa.errors.VisaIOError:VI_ERROR_TMO(1073807339):操作完成前超时
3 回答
PyVisa“更复杂的示例”根本不运行Keithley 2400不理解的命令
6 回答
PyVisapy后端
2 回答
PyVISA不能写入超过7F的十六进制字符
2 回答
PYVISA中的ENUM模块和cStringIO模块
4 回答
PyVisa代码的图形用户界面
4 回答
Pyvisa使用按键电源超时
7 回答
PyVISA和Kethley 2701只能从一个通道获取结果
7 回答
PyVisa和Printing New D
7 回答