Making pygtksourceview work in windows

Posted by Dani on Stack Overflow See other posts from Stack Overflow or by Dani
Published on 2010-06-03T17:20:31Z Indexed on 2010/06/11 18:03 UTC
Read the original article Hit count: 297

Filed under:
|
|
|

So, I'm trying to get gtksourceview python bindings work under windows (I'm developing a cross platform gtk application that shows code, so gtksourceview seemed like a natural choice).

I have pygtk installed and working (I followed the instructions in http://www.pygtk.org/downloads.html)

I tried the instructions in http://projects.gnome.org/gtksourceview/ for gtksourceview.

Here is what I did:

  1. Downloaded and extracted the latest gtksourceview window binaries from: http://ftp.gnome.org/pub/gnome/binaries/win32/gtksourceview/2.10/gtksourceview-2.10.0.zip

  2. The website said gtksourceview needs libxml, so I downloaded and extracted the latest libxml window binaries from: http://xmlsoft.org/sources/win32/libxml2-2.7.6.win32.zip

  3. Added the folders containing dll files to the PATH (in my computer they were c:\opt\gtksourceview\bin; C:\opt\libxml2-2.7.6.win32\bin)

  4. Installed pygtksourceview with the windows installer: http://ftp.gnome.org/pub/gnome/binaries/win32/pygtksourceview/2.10/pygtksourceview-2.10.0.win32-py2.6.exe

  5. Renamed the file libxml2.dll to libxml2-2.dll (after running depends on the gtksourceview dll)

Now, the gtksouceview widget seems to work, until I'm trying to set the code's language. When I do that python crashes.

Here is how I crash it in the console (the simplest way i could come up with):

>>>import gtksourceview2
>>>lang = gtksourceview2.language_manager_get_default().get_language('cpp')
>>>lang.get_style_ids() 

I'm hoping I'm not the first person to use gtksourceview in python on windows. Any ideas what I should try?

© Stack Overflow or respective owner

Related posts about python

Related posts about Windows