IronPython 2, 'with' and COM

IronPython 2 targets Python 2.5, which means that the with statement is available. This is convenient because the currently released version of IronPython 2 there is a memory leak that keeps COM objects alive after they are used.

This bug is fixed in the IronPython source code control, but in the meantime a Japanese blogger has a workaround that uses 'with' and calls Marshal.ReleaseComObject - his fantastically nested example is for Excel Interop.
His blog has some other interesting IronPython stuff, including this example of Excel 2007 interop that creates a spreadsheet from a bitmap!

Comments

Popular posts from this blog

Extending Abobe Flash Player and AIR with Python and Ruby

IronPython Tools for Visual Studio CTP3

Further Adventures of the Debugger