jackymanbo / zhpy

Automatically exported from code.google.com/p/zhpy
0 stars 0 forks source link

zhpy0.9.2 MissingSectionHeaderError #14

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
问题概述。
zhpy发生ConfigParser.MissingSectionHeaderError: File contains no section
headers错误。

如何重现问题。

环境
Simplified Chinese WinXP SP2, python 2.5.1, zhpy 0.9.2.
把C:\python25和C:\Python25\Scripts加入PATH环境变量。

步骤
开始,运行,cmd。在cmd窗口中启动python并输入如下指令。
{{{
import zhpy as z
z.zh_exec("打印 u'哈哈'")
}}}

Error as below
{{{
>>> import zhpy as z
>>> z.zh_exec("打印 u'哈哈'")
file ntuser.ini
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "c:\python25\lib\site-packages\zhpy-0.9.2-py2.5.egg\zhpy\zhpy.py",
line 254, in zh_exec
    annotator()
  File "c:\python25\lib\site-packages\zhpy-0.9.2-py2.5.egg\zhpy\zhpy.py",
line 141, in annotator
    ini_annotator(verbose)
  File "c:\python25\lib\site-packages\zhpy-0.9.2-py2.5.egg\zhpy\zhpy.py",
line 103, in ini_annotator
    conf.read(f)
  File "c:\python25\lib\ConfigParser.py", line 267, in read
    self._read(fp, filename)
  File "c:\python25\lib\ConfigParser.py", line 462, in _read
    raise MissingSectionHeaderError(fpname, lineno, line)
ConfigParser.MissingSectionHeaderError: File contains no section headers.
file: ntuser.ini, line: 1
'\xff\xfe\r\x00\n'
>>> zhpy.__version__
'0.9.2'
}}}

另外当我第一次不带任何参数运行zhpy.exe的时候也得到同样的
错误。

Original issue reported on code.google.com by ren...@gmail.com on 12 Sep 2007 at 2:05

GoogleCodeExporter commented 8 years ago
運行目錄下不能放非規則的 ini

ini 檔得是如下形式:
{{{
[關鍵詞]
系統=sys
作業系統=os
}}}

你執行的目錄下有個不合法的 ntuser.ini 檔所以會報錯.

會試著讓修正讀到不合法ini檔無法繼續的問題.

Original comment by gasolin on 13 Sep 2007 at 5:43

GoogleCodeExporter commented 8 years ago
fixed in [360]

Original comment by gasolin on 13 Sep 2007 at 7:24