Tag Archives: ironpython

XMPP and IronPython 2 using headstock, bridge and Kamaelia

I am glad to announce that IronPython 2 is now capable of running my XMPP
Python library: headstock.

.NET has already an excellent XMPP SDK called agsXMPP that is a native
.NET/C# framework. However I’m a Python developers at heart and I had
started quite a while ago writing my own XMPP library in Python using the
most excellent Kamaelia framework (designed for concurrency).

For a while IronPython had severe shortcomings that prevented it running
simple Kamaelia applications. Today I was able to run a simplechat demo
using a vanilla IP2 on Windows with only one single modification to the
logging module (thanks Seo). To be honest I didn’t expect it to go through
:)

The chat demo is simple enough but means more complex examples using XMPP
PubSub will work as well (they are all based on the same framework).

Now this isn’t production ready or anything. For instance the TLS support
is broken (hopefully something easy enough to fix) so you won’t be able to
connect to Google Talk for now.

Moreover I’m not sure the code is that fast considering how I had to
simulate an incremental XML parser atop System.Xml (this allows for a
XML stream to be parsed without requiring the full document or even
fragment to be read first).

This is a great news for me because it means I’ll be able to move ahead
with more work using IronPython 2.

IronPython, OpenGL, GLFW and SDL

Triggered by a question posted on the IronPython mailing-list by Jane Janet, I decided to see how IronPython would deal with OpenGL.
I quickly realized that the Tao framework was my best bet to gain access to OpenGL with .NET.
I therefore played a bit with the provided examples (ported from excellent tutorials such as NeHe) and started to port them to IronPython. I chose to use GLFW in order to get a context to run an OpenGL example rather than FreeGlut as I prefer the API design of GLFW.
I finally ported/wrote three examples on the IronPython cookbook as invited by Michael J. Foord.
The GLFW+OpenGL examples were easy to port and run.
However the SDL example has been quite a pain to setup. I think it comes down to the fact that Tao exposes the SDL API has an unmanaged code which means you have some conversion to do between IntPtr objects and SDL structures. Moreover I kept running into the SystemError: Missing or incorrect header for method GetValue exception when accessing structure attributes and that drove me nuts. Finally I settled for the horrible evt_type = Sdl.SDL_Event.type._get_(evt)</em> call that basically says:<em> in that structure, I want to grab the value of that field for the provided instance. Ugly I say.

Anyway I hope those few examples will help using IronPython in multimedia context without having to resort to Direct X.