After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 758760 - OpenRaster plug-In could not open image
OpenRaster plug-In could not open image
Status: RESOLVED FIXED
Product: GIMP
Classification: Other
Component: Plugins
2.8.16
Other All
: Normal normal
: 2.8
Assigned To: GIMP Bugs
GIMP Bugs
Depends on:
Blocks:
 
 
Reported: 2015-11-28 03:14 UTC by zeusex81
Modified: 2016-01-08 10:15 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Gimp error text (19.26 KB, image/png)
2015-12-02 22:10 UTC, ghostlights
  Details
proposed patch (1.07 KB, patch)
2016-01-04 12:40 UTC, Massimo
none Details | Review

Description zeusex81 2015-11-28 03:14:32 UTC
OpenRaster plug-In could not open image
That's what it says when I try to open one.
I can export ora files but I can't open them.
Comment 1 ghostlights 2015-12-02 22:10:03 UTC
Created attachment 316678 [details]
Gimp error text

I use Ubuntu 12.04 LTS and Gimp recently updated. Before, I had a plugin that could open .ora files, but since it's updated I keep getting this error message.
Comment 2 Massimo 2015-12-03 08:15:49 UTC
This happens only in gimp-2.8. If you open an .ora file GIMP
exported, you get:

Traceback (most recent call last):
  • File "/home/massimo/tmp/lib/gimp/2.0/python/gimpfu.py", line 851 in _run
    res = apply(func, params[1:])
  • File "/home/massimo/tmp/lib/gimp/2.0/plug-ins/file-openraster.py", line 274 in load_ora
    if not name:
UnboundLocalError: local variable 'name' referenced before assignment


it seems that this conflicting cherry-picked commit:

https://git.gnome.org/browse/gimp/commit/plug-ins/pygimp/plug-ins/file-openraster.py?h=gimp-2-8&id=621f5e296def8159020201b06f544517624f767d

missed an if block removal (if block that is now part of another
else branch), if you run (adjust paths to source tree):

git diff -- gimp{-2-8,}/plug-ins/pygimp/plug-ins/file-openraster.py

it outputs:


diff --git a/../gimp-2-8/plug-ins/pygimp/plug-ins/file-openraster.py b/../gimp/plug-ins/pygimp/plug-ins/file-openraster.py
index 6aa273c..c6b2949 100755
--- a/../gimp-2-8/plug-ins/pygimp/plug-ins/file-openraster.py
+++ b/../gimp/plug-ins/pygimp/plug-ins/file-openraster.py
@@ -26,7 +26,7 @@ layermodes_map = {
     "svg:src-over": NORMAL_MODE,
     "svg:multiply": MULTIPLY_MODE,
     "svg:screen": SCREEN_MODE,
-    "svg:overlay": OVERLAY_MODE,
+    "svg:overlay": NEW_OVERLAY_MODE,
     "svg:darken": DARKEN_ONLY_MODE,
     "svg:lighten": LIGHTEN_ONLY_MODE,
     "svg:color-dodge": DODGE_MODE,
@@ -271,11 +271,6 @@ def load_ora(filename, raw_filename):
             parent_groups.pop()
             continue

-        if not name:
-            # use the filename without extention as name
-            n = os.path.basename(path)
-            name = os.path.splitext(n)[0]
-
         if item.tag == 'stack':
             name, x, y, opac, visible, layer_mode = get_group_layer_attributes(item)
             gimp_layer = gimp.GroupLayer(img)



removing it also in gimp-2.8 fixes the issue.
Comment 3 ghostlights 2015-12-04 07:33:18 UTC
(In reply to Massimo from comment #2)
> This happens only in gimp-2.8. If you open an .ora file GIMP
> exported, you get:
> 
> Traceback (most recent call last):

So, is this something I can fix myself then? I don't have any experience when it comes to these things so I don't even know where I can find what you're talking about.
Comment 4 Massimo 2015-12-04 17:55:40 UTC
(In reply to ghostlights from comment #3)
> (In reply to Massimo from comment #2)
> > This happens only in gimp-2.8. If you open an .ora file GIMP
> > exported, you get:
> > 
> > Traceback (most recent call last):
> 
> So, is this something I can fix myself then? I don't have any experience
> when it comes to these things so I don't even know where I can find what
> you're talking about.

Theoretically you could fix it yourself if you have urgent
need to edit OpenRaster files. 

You have to find the file 'file-openraster.py' which should
be in the directory /usr/lib/gimp/2.0/plug-ins/

The prefix /usr could be /usr/local or /opt or something else
and lib could be lib64, anyway in that file you'll have to
delete lines 274, 275, 276 and 277 that are:

        if not name:
            # use the filename without extention as name
            n = os.path.basename(path)
            name = os.path.splitext(n)[0]


beware few lines below this text is repeated but that's correct.


But probably it is better if you wait until the next stable release,
assuming there will be one.
Comment 5 Massimo 2016-01-04 12:40:23 UTC
Created attachment 318208 [details] [review]
proposed patch

It seems the branch gimp-2-8 is still updated
so if there are no objections I'll push the
attached patch
Comment 6 ghostlights 2016-01-04 21:58:52 UTC
A patch sounds good to me! I couldn't manage to change the file myself with what you suggested earlier.
Comment 7 Massimo 2016-01-07 16:55:45 UTC
Fixed in master:

commit d4cebcea8fec7c74b65bd94332d5ac8ce4c303c7
Author: Massimo Valentini <mvalentini@src.gnome.org>
Date:   Thu Jan 7 17:49:52 2016 +0100

    Bug 758760: OpenRaster plug-In could not open image
    
    An oversight while cherry-picking in
    
    621f5e296def8159020201b06f544517624f767d
Comment 8 ghostlights 2016-01-07 22:17:05 UTC
(In reply to Massimo from comment #7)
> Fixed in master:
> 
> commit d4cebcea8fec7c74b65bd94332d5ac8ce4c303c7
> Author: Massimo Valentini <mvalentini@src.gnome.org>
> Date:   Thu Jan 7 17:49:52 2016 +0100
> 
>     Bug 758760: OpenRaster plug-In could not open image
>     
>     An oversight while cherry-picking in
>     
>     621f5e296def8159020201b06f544517624f767d

So, how can I apply the patch to gimp then? I've never done that before.
Comment 9 Massimo 2016-01-08 06:16:16 UTC
(In reply to ghostlights from comment #8)
> (In reply to Massimo from comment #7)
> > Fixed in master:
> > 
> > commit d4cebcea8fec7c74b65bd94332d5ac8ce4c303c7
> > Author: Massimo Valentini <mvalentini@src.gnome.org>
> > Date:   Thu Jan 7 17:49:52 2016 +0100
> > 
> >     Bug 758760: OpenRaster plug-In could not open image
> >     
> >     An oversight while cherry-picking in
> >     
> >     621f5e296def8159020201b06f544517624f767d
> 
> So, how can I apply the patch to gimp then? I've never done that before.

It is no longer necessary to apply the patch as it
is now fixed in git and will be in the next stable release.

The patch attached to comment 5 is a patch for GIMP sources,
after applying it, it is necessary to install GIMP 
to be effective.



To fix an installed GIMP it is easier to find the file 

file-openraster.py

and delete lines 274, 275, 276 and 277.
Comment 10 Michael Schumacher 2016-01-08 10:15:42 UTC
We probably have different definitions of "patch" here - to some people, especially on the windows platforms, this means an executable file that can be run to apply the changes (I am *not* referring to the patch command).

Grabbing the current version of the plug-in is an option, though - as it is written in Python, you can just replace the .py file in GIMP's plug-ins directory (that is, lib\gimp\2.0\plug-ins\ ) by this one:

https://git.gnome.org/browse/gimp/plain/plug-ins/pygimp/plug-ins/file-openraster.py?h=gimp-2-8