在 IronPython 脚本中实例化 collections.OrderedDict() 时,我得到以下信息:
System.MissingMemberException: 'NoneType' object has no attribute 'f_back'
at logging$33.findCaller$1681(PythonFunction $function, Object self) in C:\Python26\Lib\logging\__init__.py:line 1101
at logging$33._log$1683(PythonFunction $function, Object self, Object level, Object msg, Object args, Object exc_info, Object extra) in C:\Python26\Lib\logging\__init__.py:line 1129
at logging$33.info$1675(PythonFunction $function, Object self, Object msg, Object args, Object kwargs) in C:\Python26\Lib\logging\__init__.py:line 1021
调用它的脚本在其他 Windows 机器上工作正常,只出现在我的机器上。我根本不熟悉日志记录功能 - 任何人都可以解释一下吗?
Python 版本 2.6
IronPython 版本 2.7.1
非常感谢
请您参考如下方法:
看起来您正在尝试将 Python 2.6 中的库与 IronPython 2.7 一起使用。您应该改用 IronPython 2.7 的标准库,它有一堆修复和变通办法可以让它工作(不完美,但好多了)。
例如,我在 IronPython 2.7.3 上得到以下信息:
>>> from collections import OrderedDict
>>> od = OrderedDict()
>>> od[1] = 2
>>> od[0] = 4
>>> od
OrderedDict([(1, 2), (0, 4)])
>>>
您很可能将 IRONPYTHONPATH 变量设置为在 IronPython 的 Lib 之前拥有 Python 的 Lib。这曾经是必需的(对于 IronPython < 2.6),但现在不推荐这样做。
