Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gi.repository.GLib.Error: rsvg-error-quark: Error displaying image #12

Closed
Saumya-Mishra9129 opened this issue May 11, 2020 · 26 comments
Closed

Comments

@Saumya-Mishra9129
Copy link
Member

Saumya-Mishra9129 commented May 11, 2020

Traceback (most recent call last):
  File "/usr/share/sugar/activities/pukllanapac/PukllanapacActivity.py", line 186, in change_play_mode_cb
    GAME_ICONS[self._play_mode])
  File "/usr/share/sugar/activities/pukllanapac/grid.py", line 60, in initialize_cards
    x, y, 'hexagon'))
  File "/usr/share/sugar/activities/pukllanapac/card.py", line 43, in __init__
    card_dim * scale))
  File "/user/share/sugar/activities/pukllanapac/card.py", line 20, in load_image
    return Pixbuf.new_from_file_at_size(file, int(w), int(h))
gi.repository.GLib.Error: rsvg-error-quark: Error displaying image (2)
1589180438.254853 ERROR root: Error saving activity object to datastore
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/sugar3/activity/activity.py", line 1277, in _prepare_close
    self.save()
  File "/usr/lib/python2.7/dist-packages/sugar3/activity/activity.py", line 978, in save
    self.write_file(file_path)
  File "/usr/share/sugar/activities/pukllanapac/PukllanapacActivity.py", line 97, in write_file
    self.win.grid.card_table[self.win.grid.grid[i]].orientation)
IndexError: list index out of range

Getting this error while closing the activity and only after selecting hexagon game. Nothing is displayed after selecting hexagon game and when we click stop it shows keep error.
#11 is a part of this error. We get both error together. It is also mentioned in #10 anyone want to work on issue must look at that pull request first.

@JuiP
Copy link
Member

JuiP commented May 19, 2020

@quozl @chimosky Slight hint about this error will be really helpful. I googled it but couldn't find anything helpful :(

@shaansubbaiah
Copy link
Member

There's a typo in the PATH constant, not sure if that contributes to the issue.

PATH = '/org/augarlabs/PukllanapacActivity'

@JuiP
Copy link
Member

JuiP commented May 19, 2020

Hey, @shaansubbaiah Thanks for noticing! :)
Tested after fixing the typo, the error still remains. I'm not too sure what this error actually means.

@srevinsaju
Copy link
Member

Something I found out during GCI, might be useful
The error happens due to some reasons

  • The image is in a badly formatted base64 img
  • If the image used is an SVG, the SVG is not well written / saved (try opening the svg in inkscape)
  • The file path to the image is not correct

I have not seen the code now, in case someone would like to start debugging on the same

@srevinsaju
Copy link
Member

@Saumya-Mishra9129 can't reproduce the error on #13, did you get the error there? ;
What I did:

  • Open the activity
  • Click the hexagon thing
  • randomly click on the hexagons;

I did not receive any tracebacks in the logs though

@Saumya-Mishra9129
Copy link
Member Author

Saumya-Mishra9129 commented May 19, 2020

@Saumya-Mishra9129 can't reproduce the error on #13, did you get the error there? ;
What I did:

  • Open the activity
  • Click the hexagon thing
  • randomly click on the hexagons;

I did not receive any tracebacks in the logs though

I havent tested yet, but this was the way I get on master-

Getting this error while closing the activity and only after selecting hexagon game. Nothing is displayed after selecting hexagon game and when we click stop it shows keep error.

@JuiP have you get the same error after port on #13 also??

@Saumya-Mishra9129
Copy link
Member Author

Something I found out during GCI, might be useful
The error happens due to some reasons

The image is in a badly formatted base64 img
If the image used is an SVG, the SVG is not well written / saved (try opening the svg in inkscape)
The file path to the image is not correct
I have not seen the code now, in case someone would like to start debugging on the same

@srevinsaju I agree with you. This is what I found earlier after searching on google. This is also what I get msys2/MINGW-packages#818

@JuiP
Copy link
Member

JuiP commented May 19, 2020

@JuiP have you get the same error after port on #13 also??

@Saumya-Mishra9129 Yes I can reproduce the error on #13

@srevinsaju For your reference try clicking on the game which is selected in this screenshot. If this works for you, then this error may actually be related to rsvg packaging on different linux systems. I had found something related to this while googling, I can't traceback the exact link at the moment. Also, it is likely that I may have misinterpreted the information.
Pukllanapac

The error happens due to some reasons

  • The image is in a badly formatted base64 img
  • If the image used is an SVG, the SVG is not well written / saved (try opening the svg in inkscape)
  • The file path to the image is not correct

Thanks! While debugging, I checked the file path argument is correct.

@srevinsaju
Copy link
Member

srevinsaju commented May 19, 2020

In both cases #10 and #13 there is a commit of running 2to3 is visible except for print statements. On #10, @chimosky was able to reproduce gi.repository.GLib.Error: rsvg-error-quark: Error displaying image on python2 and python3. This creates a confusion.


[EDIT]; Related to #12 (comment)

For me everything works perfectly except a few IndexErrors, I can see the hexagons.

@srevinsaju For your reference try clicking on the game which is selected in this screenshot. If this works for you, then this error may actually be related to rsvg packaging on different linux systems. I had found something related to this while googling, I can't traceback the exact link at the moment. Also, it is likely that I may have misinterpreted the information.

Great @JuiP. This is also seen in sugarlabs/fractionbounce#16, sugarlabs/fractionbounce#15 where similar errors and differences in the tracebacks in mine and @quozl 's might be due to the same reason. Need to bring it to other's view too. Thanks for a possible explanation.

On FractionBounce, I was not able to load custom image during GCI and while creating a flatpak due to the same reason; For some reason I were having the same errors, which caused me to hardcode the image binary into the svg file so that that there is no gi.repository.GLib.Error: rsvg-error-quark: Error displaying image. See sugarlabs/fractionbounce#15 for the unresolved discussion regarding the same

@srevinsaju
Copy link
Member

@JuiP @Saumya-Mishra9129 Can you tell me if you have the executable rsvg-convert, if yes, what is the output of

rsvg-convert -v

@quozl
Copy link
Contributor

quozl commented May 20, 2020

Thanks, that's interesting. rsvg-convert is in the librsvg2-bin package on Debian and Ubuntu. rsvg-convert shows the version of LibRsvg.

We saw rsvg-error-quark also on sugarlabs/fractionbounce#16 as mentioned, and so my guess is;

  • the activity does something wrong with the SVG, but it was harmless at the time,
  • recent versions of LibRsvg are complaining about it.

You might downgrade LibRsvg to check. If you really can't figure it out, then using git bisect on LibRsvg sources would do the trick, but take a long time.

@quozl
Copy link
Contributor

quozl commented May 20, 2020

You might also separate the problem from the activity. At the point of the traceback, use a debugger or print to check w and h are reasonable, and check file is a file, and check that you can read the file using rsvg-view-3.

@srevinsaju
Copy link
Member

@quozl I tested with debian live build 0.116, both the activities do not work. I am building librsvg from source to check if the error is resolved with a newer version

@Saumya-Mishra9129
Copy link
Member Author

Saumya-Mishra9129 commented May 20, 2020

I have tried to fix it in 46a08e0. Please Review, it is working for me. @JuiP you can cherry-pick if working fine. Thanks.

@srevinsaju
Copy link
Member

srevinsaju commented May 20, 2020

@Saumya-Mishra9129 wow!


As mentioned in #12 (comment); it has turned out to be

  • If the image used is an SVG, the SVG is not well written / saved (try opening the svg in inkscape)

I am curious about what happens in FractionBounce though, need to check if the same error exists there too. Thanks

@Saumya-Mishra9129
Copy link
Member Author

As mentioned in #12 (comment); it has turned out to be

If the image used is an SVG, the SVG is not well written / saved (try opening the svg in inkscape)

Yeah This helped. Thanks

@JuiP
Copy link
Member

JuiP commented May 20, 2020

Thanks! tested @Saumya-Mishra9129 , it works! ^_^
Just out of curiosity could you explain in brief how you found out the fix after opening in inkscape?

@srevinsaju
Copy link
Member

@JuiP in normal cases, open the svg in inkscape, save it, take the diff.
Inkscape will automatically correct the svg file to match svg file conventions. But, however, inkscape adds a lot of sodipodi bloat, which has to be selectively removed and selected.

The diff will help to find out what change was made by inkscape and will give some clue on how to fix the error.

@JuiP
Copy link
Member

JuiP commented May 20, 2020

@JuiP in normal cases, open the svg in inkscape, save it, take the diff.
Inkscape will automatically correct the svg file to match svg file conventions. But, however, inkscape adds a lot of sodipodi bloat, which has to be selectively removed and selected.
The diff will help to find out what change was made by inkscape and will give some clue on how to fix the error.

Well yes I did the exact same thing before asking about her process, however my git diff didnot show me a change in width like in the commit 46a08e0. Nevermind, the commit works perfectly!

@srevinsaju
Copy link
Member

srevinsaju commented May 20, 2020

@JuiP I am not sure if @Saumya-Mishra9129 found the error using inkscape, but this is my diff

https://www.diffchecker.com/HQCBo8ab

You can see how the width 202. is changed to just 202 along with some additional bloat

@quozl
Copy link
Contributor

quozl commented May 20, 2020

It does say <!-- Created with Python in Emacs -->. It means it is hand hewn, like a stone house, and may have cracks.

@srevinsaju
Copy link
Member

Hmm, Interestingly, librsvg 2.48 fixed this parsing error, and hence works on librsvg 2.48 on my host system, but fails on librsvg version < 2.44 Need to investigate which commit made the change on the upstream source. This fix however adds the support for older Sugar and OSes released with older librsvg packages

@quozl
Copy link
Contributor

quozl commented May 20, 2020

Yes, that is interesting. It suggests faults in LibRsvg are driving us to make changes. 😁 That's why it is important to get to the bottom of why something doesn't work; don't just accept the behaviour or a fix that seems to work.

@JuiP
Copy link
Member

JuiP commented May 20, 2020

😀 I'm glad my research on the error helped slightly figure out the cause! I was looking at the bugs reported in rsvg packages, the link is for an older version. One such bug reports also mentioned that other person could not reproduce the error, he used a different linux distros and LibRsvg version which I related it with you not being able to reproduce the same error. For your interest, you might have a look at this too

@srevinsaju
Copy link
Member

Today was indeed a bug fix day. Seems like we made a lot of progress on many repositories ;)

@quozl
Copy link
Contributor

quozl commented May 20, 2020

https://gitlab.gnome.org/GNOME/librsvg may also help, by speed-reading commits between two version tags.

@JuiP JuiP mentioned this issue May 21, 2020
3 tasks
@quozl quozl closed this as completed May 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants