Python error message saving as Synfig (sif), trunk

Bug #1663362 reported by Alvin Penner on 2017-02-09
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Inkscape
Medium
Jabiertxof

Bug Description

- Windows 10, Inkscape 0.92+devel 15458
- any attempt to save as .sif leads to the error message below:
- not reproduced on Windows 10, Inkscape 0.92.0 r15299

...............................................................
Traceback (most recent call last):
  File "synfig_output.py", line 1352, in <module>
    e = SynfigExport()
  File "synfig_output.py", line 1049, in __init__
    svg = self.document.getroot()
AttributeError: SynfigExport instance has no attribute 'document'

jazzynico (jazzynico) wrote :

Not reproduced on Windows XP (32-bit), lp:inkscape/0.92.x rev. 15367.

tags: added: exporting extensions-plugins
Changed in inkscape:
milestone: none → 0.93
tags: added: regression
su_v (suv-lp) wrote :

On Ubuntu 14.04.5 LTS:
- not reproduced with lp:inkscape/0.92.x r15367
- reproduced with lp:inkscape r15498

Python error:
Traceback (most recent call last):
  File "synfig_output.py", line 1352, in <module>
    e = SynfigExport()
  File "synfig_output.py", line 1049, in __init__
    svg = self.document.getroot()
AttributeError: SynfigExport instance has no attribute 'document'

Changed in inkscape:
status: New → Confirmed
su_v (suv-lp) wrote :
summary: - Python error message saving as Synfig (sif), Windows 10, trunk
+ Python error message saving as Synfig (sif), trunk
jazzynico (jazzynico) wrote :

Also reproduced on Xubuntu 16.04, lp:inkscape rev. 15498.

Changed in inkscape:
importance: Undecided → Medium
status: Confirmed → Triaged
jazzynico (jazzynico) wrote :

@jabiertxof, could you please explain why the Synfig and HPGL extensions needed to be modified here? Removing the changes from rev. 15444 fixes the Synfig export with no obvious issue.
The HPGL export works with your changes, but I just don't see the point.
Thanks!

Changed in inkscape:
assignee: nobody → Jabiertxof (jabiertxof)
jazzynico (jazzynico) wrote :

> Removing the changes from rev. 15444 fixes the Synfig export

Removing the changes for the Synfig extension only, not the whole revision.

Alvin Penner (apenner) wrote :

@jabiertxof, I guess I have the same question as jazzynico, why was it necessary to modify these two Python extensions. If I understand correctly, they get their information from a temporary file so there is no danger of accidentally corrupting the original svg file, and at the same time they do not need to actually use the information in the ("inkscape:document_rotation") variable, do they?

Alvin Penner (apenner) wrote :

after patching the file 'synfig_output.py' as suggested in comment 6, there is still a residual crash obtained on Windows 10. This occurs only if there is a non-path element in the drawing.
    The new crash is caused by the same thing as occurred in:
https://bugs.launchpad.net/inkscape/+bug/1662531/comments/8
see also: https://bugs.launchpad.net/inkscape/+bug/1662531/comments/29
    Attached is a modified version of the file 'synfig_prepare.py' which fixes the new crash.

Jabiertxof (jabiertxof) wrote :

This weekend go into. Forget the bug asigned to me.

Jabiertxof (jabiertxof) wrote :

and introduced by me

Alvin Penner (apenner) wrote :

the crash referred to in comment 8 is actually a duplicate of Bug 1666314
https://bugs.launchpad.net/inkscape/+bug/1666314

I think this can be ignored for the moment, only the original bug in comment 1 is of interest here.

Jabiertxof (jabiertxof) wrote :

Thanks Alvin!

Jabiertxof (jabiertxof) wrote :

I do the changes because wrong positioned elements on export SIF files when the doc is rotated. Now working in a fix for the bug.

Jabiertxof (jabiertxof) wrote :

I do the changes because wrong positioned elements on export SIF files when the doc is rotated. Now working in a fix for the bug. Attached a fix for bug

Alvin Penner (apenner) wrote :

thanks for the patch. just for curiosity, do you have an example of an svg file that gets wrongly positioned if it is output to sif? It is not clear to me why a change in code is necessary in the first place.

Jabiertxof (jabiertxof) wrote :

Hoooo! No need to apply the patch. I try it time ago and the thing need to be done, maybe there is changes to code or I dont test it ok. Thanks for insist Alvin!

Jabiertxof (jabiertxof) wrote :

I remove the code today.

Jabiertxof (jabiertxof) wrote :

Fixed patch, removed rotate code from synfig export and fixed HPGL one. Any one can test HPGL code is correct are welcome.

Alvin Penner (apenner) wrote :

  thanks for the patch. From the appearance of the synfig patch, it looks as if this should work correctly.
  However I am still confused as to the changes in the hpgl code. The synfig patch removes all the effects of rev 15444, which I believe is the correct thing to do. I do not understand why the hpgl patch does not do the same. I mean, why does the hpgl code have a compensation for document rotation in it?
    I did the following experiment just for curiosity. I reverted the hpgl_output.py file back to rev 15443. Then I created a new test file and rotated it by 40 degrees. Then I saved it as svg, and also saved it as hpgl, and then saved it as svg again, to see if it had changed. Then I viewed the hpgl file to confirm that it was correct, and then I compared the two svg files, from before and after, and confirmed that they were identical, apart from the file name which I had changed. So if the hpgl file is correct and if the svg file has not been corrupted, then why is it necessary to make any changes in the hpgl_output.py file? My understanding is that it is not possible for a Python output routine to corrupt the original svg file. I am not sure if that is the case for the internal extensions written in C, but I believe that is the case for the Python output extensions.
    Sorry for being a pest about this. I am not trying to give you a hard time, but I am trying to understand why these changes were necessary in the first place.

Jabiertxof (jabiertxof) wrote :

Hi Alvin. Im going to remove the hpgl. And dont worry, dont know why when try it first time it render bad, not sure fi I do a bad test or change somethin in extensions beabiour.
Thanks so much for the time spend on my bug, i go to make another patch removing also from HPGL, I hope tonight.

Cheers, Jabier.

Jabiertxof (jabiertxof) wrote :

The code cleaned. Ping me if want me to push.
Thanks so much for the help provided in this bug.
Cheers, Jabier.

Alvin Penner (apenner) wrote :

thanks for the patch, it looks good to me.
just one minor comment: I think you probably do not need the statement
from inkex import NSS
in the file hpgl_output.py. This statement was added in rev 15444 and is probably no longer needed.

Jabiertxof (jabiertxof) wrote :

Hi Alvin here are the fixed patch. Ping me if you want me to commit the patch.
Cheers, Jabier.

Alvin Penner (apenner) wrote :

@Jabiertxof -
looks good to me!
thanks for doing this.

jazzynico (jazzynico) on 2017-03-08
Changed in inkscape:
status: Triaged → In Progress
Jabiertxof (jabiertxof) wrote :

ok fixed in r.15578. Thanks!

Changed in inkscape:
status: In Progress → Fix Released
jazzynico (jazzynico) on 2017-03-08
Changed in inkscape:
milestone: 0.93 → none
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers