Save as xcf results in empty file on gentoo linux

Bug #168277 reported by Babelfish42 on 2007-01-26
Affects Status Importance Assigned to Milestone
Aaron C Spike

Bug Description

Saving as .xcf with layers (for later use with gimp) results in an empty

The following lines are output at the console:

(inkscape:23647): GLib-CRITICAL **: g_utf8_collate: assertion `str2 !=
NULL' failed
Extension::Script: Unknown error for pclose
: No such file or directory

I'm running inkscape 0.44 on Gentoo Linux, but the same (or similar) error
is also reported to happen with 0.43.

Edit/Additional info:
with 0.44.1, I get a dialog box saying

** (inkscape:10707): WARNING **: Format autodetect failed. The file is
being opened as SVG.
This is a development version of GIMP. Debug messages may appear here.

No batch interpreter specified, using the default
plug-in 'script-fu' aborted before sending its procedure return values
Traceback (most recent call last):
  File "/usr/share/inkscape/extensions/", line 92, in ?
  File "/usr/share/inkscape/extensions/", line 123, in affect
  File "/usr/share/inkscape/extensions/", line 87, in effect
    x = open(xcf, 'r')
IOError: [Errno 2] No such file or directory: u'/tmp/tmpMZtaEp/test.xcf'

Horkana-users (horkana-users) wrote :

Originator: NO

script-fu is part of GIMP, those are gimp errors causing errors in

All this script/extension/plugin does is automate the process of opening a
SVG file in the gimp and then saving it again as XCF. GIMP can import SVG
and will give you many more options on how to control the input. I would
strongly recommend you try that workaround for now.

What version of GIMP are you using?

Bug Importer (bug-importer) wrote :

This happend both with the stable gimp version 2.2.12 and the development
release 2.3.14.

Well, at least the layers seem to be saved in the /tmp/tmpFOO/ directory,
so I could use them :-)

Would it be appropriate to report this as a gimp bug?
AFAIK gimp can't import SVG with layers/ top level groups as xcf layers,
so the problem seems to be collating the pngs to xcf layers, not converting
svg to png.

Babelfish42 (babelfish42) wrote :

Originator: YES

Correction: I couldn't reproduce it with 2.2.12, xcf didn't even show up
as an option, so it could be that this is 2.3.x specific. Nor could it be
reproduced by another person I asked, on Ubuntu.
I'll probably cross-post this as a bug on gentoo, maybe they did some
hacks that went wrong.

Prokoudine (prokoudine) wrote :

Originator: NO

Can you reproduce it now?

Babelfish42 (babelfish42) wrote :

Originator: YES

Yes I can still reproduce it now, with Inkscape 0.45.1 and Gimp 2.4.0
(could 2.4.1 possibly make a difference?). The inkscape error dialog
message is a bit different now, though, saying;

** (inkscape:7098): WARNING **: Format autodetect failed. The file is
being opened as SVG.
No batch interpreter specified, using the default

(gimp:7101): Gimp-Base-WARNING **: tile cache not empty (3130752 bytes
Traceback (most recent call last):
  File "/usr/share/inkscape/extensions/", line 92, in ?
  File "/usr/share/inkscape/extensions/", line 157, in affect
  File "/usr/share/inkscape/extensions/", line 87, in effect
    x = open(xcf, 'r')
IOError: [Errno 2] No such file or directory:

Indeed /tmp/tmp5pSrre/ink_ext_6N.xcf does not exist, but there is:

$ ls -l /tmp/tmp5pSrre/
total 20
-rw-r--r-- 1 daniel users 127 Nov 1 10:52 junk_from_gimp.txt
-rw-r--r-- 1 daniel users 13871 Nov 1 10:52 layer1.png
$ cat /tmp/tmp5pSrre/junk_from_gimp.txt
Welcome to TinyScheme, Version 1.38
Copyright (c) Dimitrios Souflis

> png-to-layer
> Error: car: argument 1 must be: pair


This error message lets me hope for an easy fix :-) Sorry I don't know
either TinyFu nor python...

vonHalenbach (lustik) on 2007-12-10
Changed in inkscape:
status: New → Confirmed

I also had this error, it is because the gimp changed scheme interpreters in version 2.4 from SIOD to TinyScheme. I think that I may have fixed it in the attached script, it still gives warnings but the image is still created correctly. This is my first time fixing a bug, so I'm sorry if this isn't the correct way to submit this.

Tom Davidson (tjd-mit) wrote :

Thanks for the patch! perhaps Aaron can consider it for inclusion, or reassign it to the appropriate person?

Changed in inkscape:
assignee: nobody → acspike
Tom Davidson (tjd-mit) wrote :

Milestoning so that a dev will review the patch

Changed in inkscape:
importance: Low → Medium
milestone: none → 0.46
Aaron C Spike (acspike) wrote :

Thanks for the fix. Its best to submit a diff against the latest version of svn. I've gone back in the svn history and diffed your script against the version that looks closest. Could you please look the diff over and explain your changes. If you are willing you could even grab the latest version of this script from svn and work to update that version.

Would it be possible to make this script operate with new and old gimp?

The diff follows:

--- /home/aaron/Desktop/ 2008-02-10 14:46:52.000000000 -0600
+++ /home/aaron/Desktop/ 2008-02-10 14:41:55.000000000 -0600
@@ -48,6 +48,7 @@
         filelist = '"%s"' % '" "'.join(pngs)
         xcf = os.path.join(tmp_dir, "%s.xcf" % docname)
         script_fu = """
+(tracing 1)
   (png-to-layer img png_filename)
@@ -56,6 +57,7 @@
       (png_layer (car (gimp-image-get-active-layer png)))
       (xcf_layer (car (gimp-layer-new-from-drawable png_layer img)))
     (gimp-image-add-layer img xcf_layer -1)
     (gimp-drawable-set-name xcf_layer png_filename)
@@ -66,11 +68,11 @@
   (gimp-image-undo-disable img)
   (let* ((filelist '(%s)))
- (while filelist
- (let* ((filename (car filelist)))
- (png-to-layer img filename)
+ (for-each
+ (lambda (filename)
+ (png-to-layer img filename)
- (set! filelist (cdr filelist))
+ filelist
   (gimp-image-resize-to-layers img)
@@ -89,4 +91,4 @@

 e = MyEffect()
\ No newline at end of file

Aaron C Spike (acspike) wrote :

ok, I think I've got a working script in svn now. Tom, can you try it? (In my tests inkscape crashes but the tempfile created by the script is correct. The inkscape crash is a new bug)

Bryce Harrington (bryce) wrote :

Any word so far on this? I know Kees recently modified how tempfiles are handled - perhaps that took care of the crash?

Bryce Harrington wrote:
> Any word so far on this? I know Kees recently modified how tempfiles
> are handled - perhaps that took care of the crash?

r17396 still crashes.

Aaron C Spike (acspike) wrote :

crash should be fixed now as of 17422

Changed in inkscape:
status: Confirmed → Fix Committed
Tom Davidson (tjd-mit) wrote :

Another one down! Works great under Fedora 8 in SVN rev 17424. Test SVG had linked images, which worked well...

Changed in inkscape:
status: Fix Committed → Fix Released
su_v (suv-lp) on 2010-06-14
tags: added: xcf
removed: extensions
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Duplicates of this bug

Other bug subscribers