Hi all,

I have a cross-platform issue on loading SVG files with PyGTK.

On my Ubuntu installation the following Python code runs without problems±

import pygtk
import gtk
p = gtk.gdk.pixbuf_new_from_file('tree.svg')

On WIndows I get the following error:

gobject.GError: Couldn't recognize the image file format for file 'tree.svg'

I've investigated extensively. I have installed the librsvg library and its
many dependencies.

When I first ran gdk-pixbuf-query-loaders.exe it returned text with comments
only. When I placed the svg_loader.dll file
in the C:\gtk2\lib\gdk-pixbuf-2.0\2.10.0\loaders directory, then it showed
the SVG module, just like on my Ubuntu machine.
It then complained about missing dependencies, which I added one by one
until the error messages stopped.

As instructed I've redirected the output from the tool to
C:\gtk2\lib\gdk-pixbuf-2.0\2.10.0\loaders\loaders.cache

The file's contents now is:

# GdkPixbuf Image Loader Modules file
# Automatically generated file, do not edit
# Created by gdk-pixbuf-query-loaders.exe from gdk-pixbuf-2.22.0
#
# LoaderDir = C:\gtk2/lib/gdk-pixbuf-2.0/2.10.0/loaders
#

"C:/gtk2/lib/gdk-pixbuf-2.0/2.10.0/loaders/svg_loader.dll"
"svg" 2 "gdk-pixbuf" "Scalable Vector Graphics" "LGPL"
"image/svg+xml" "image/svg" "image/svg-xml" "image/vnd.adobe.svg+xml"
"text/xml-svg" "image/svg+xml-compressed" ""
"svg" "svgz" "svg.gz" ""
" <svg" "* " 100
" <!DOCTYPE svg" "* " 100

My GTK installation seems to be correct, when I run the rsvg-view.exe it
displays any .svg file correctly.
When I look with the popular Win32 Dependency Walker tool, then I also see
that it loads, along million other DLLs ;-), the following item in the log:
Loaded "c:\gtk2\bin\LIBRSVG-2-2.DLL" at address 0x68E40000. Successfully
hooked module.""

When I profile the Python interpeter and type the code mentioned at the top,
then I don't see this DLL in the profile output, so it
seems PyGTK simply ignores librsvg and does not even attempt to load it (I'd
believe DW would give an error if it tried but not succeed). I see it loads
several other dlls from the same gtk2\bin directory though.

I fear it“s a version mismatch or something.

Here are some version numbers that I think are important. Is someone with a
similair setup with working librsvg
willing to check their versions? Or the output of the
gdk-pixbuf-query-loaders.exe tool?

- Python 2.5
- GTK runtime 2.22
- PyGTK 2.121.3
- PyCairo 1.412
- SVG-gdk-pixbuf-loader 2.26.2
- SVG GTK Engine 2.262.1
- libxml2 2.7.7
- libglade 2.6.4
- libbzip2 1.0.5
- libcroco 0.6.2.1

Of course, GTK is also the first entry in the system's path. I am using
Windows 7 Home Premium 64-bit by the way, but only installed Win32 versions
of all GTK and Python-related stuff.

I hope someone is willing to help me, I spent literary many days on this
issue and don't really know where to look next. Any help would be greatly
appreciated. Many thanks!

Best regards,
Vincent
_______________________________________________
pygtk mailing list   [email protected]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/

Reply via email to