23 Nov 2005 lkcl   » (Master)

_well_. living in interesting times. things i am happy to talk about:

IronPython

_wow_ what an amazing concept - python, a scripting language, reimplemented (aiming for byte-code interoperability) that can also understand CLR - the runtime thingy for .NET.

so, you can write programs cross-platform, because of mono.

it's still early days, yet, because everyone is going "oo, look, cool new toy" and it's incredibly difficult to locate actual real code.

also, if it's not available from .NET (mono) then forget it. in other words: you know all those nice python libraries you rely on - the ones that aren't written in pure python, they're actually using c-code behind-the-scenes? forget aaaallll about them.

fortunately, that's not _such_ a big hairy deal because you have access to the entire .NET (mono) system library suite.

basically, you're programming in .NET, but writing code in python. i feel sorry for the poor dickheads who say "ironpython is great! but i reaaally miss the auto-completion feature of visual studio: when is IronPythonConsole.exe going to get that?" fuckofff, bitch! learn to type! use your memory and learn to use google! as a side-effect you'll also be able to program top-down instead of being forced to code bottom-up because unless all your classes are populated with stubs the auto-completion feature of visual studio forces system function names you didn't want down your throat.

anyway.

a few hair-raising things i came across, that are really important, especially if you're using debian/unstable (or debian/testing):

1) ironpython 0.6 works with mono 1.1.9. it's a bit grungy. (System.XML reader doesn't work.)

2) ironpython 0.9.4 works with mono 1.1.10.

3) ironpython 0.9.5 works (compiles) with a version of mono > 1.1.10 and so it's not _quite_ there yet.

4) you must must _must_ add these lines to /etc/mono/config in order to get Gdk to work:

<dllmap dll="libgdk-win32-2.0-0.dll" target="libgdk-x11-2.0.so.0"/>
<dllmap dll="libgtk-win32-2.0-0.dll" target="libgtk-x11-2.0.so.0"/>
<dllmap dll="libgdk_pixbuf-2.0-0.dll" target="libgdk_pixbuf-2.0.so.0"/>

what else: oh, yes, this trick is really useful, and necessary:

import sys
sys.LoadAssemblyByName("System.Xml")

and _then_ you can "import System.Xml".

the same thing goes for gdk-sharp and gdk-sharp:

import sys
sys.LoadAssemblyFromFile ("/usr/share/dotnet/mono/gtk-sharp/gdk-sharp.dll")
import Gdk
sys.LoadAssemblyFromFile ("/usr/share/dotnet/mono/gtk-sharp/gtk-sharp.dll")
import Gtk

which is _really_ ugly but it works (i wonder what i'm supposed to do on win32, there? oh well).

start your programs with this, or something similar:

#!/usr/bin/mono /usr/src/ironpy/IronPython-0.6/bin/IronPythonConsole.exe

it will save you typing it out every time..

am still looking for a way to access MySQL...

Latest blog entries     Older blog entries

New Advogato Features

New HTML Parser: The long-awaited libxml2 based HTML parser code is live. It needs further work but already handles most markup better than the original parser.

Keep up with the latest Advogato features by reading the Advogato status blog.

If you're a C programmer with some spare time, take a look at the mod_virgule project page and help us with one of the tasks on the ToDo list!