Pyderman
Pyderman

Reputation: 16227

Python / IronPython logging : 'NoneType' object has no attribute 'f_back'

When collections.OrderedDict() is instantiated in an IronPython script, I get the following:

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

The script calling this works fine on other Windows boxes, only occurs on my box. I'm not familiar with the logging functionality at all - can anyone shed some light?

Python version 2.6

IronPython Version 2.7.1

Many thanks

Upvotes: 2

Views: 1857

Answers (1)

Jeff Hardy
Jeff Hardy

Reputation: 7662

It looks like you're trying to use the library from Python 2.6 with IronPython 2.7. You should use IronPython 2.7's standard library instead, which has a bunch of fixes and workarounds that make it work (not perfect, but a lot better).

For example, I get the following on IronPython 2.7.3:

>>> from collections import OrderedDict
>>> od = OrderedDict()
>>> od[1] = 2
>>> od[0] = 4
>>> od
OrderedDict([(1, 2), (0, 4)])
>>>

Most likely you set the IRONPYTHONPATH variable to have Python's Lib before IronPython's Lib. That used to be required (for IronPython < 2.6), but now it's not recommended.

Upvotes: 2

Related Questions