Opened 21 years ago

Closed 21 years ago

#816 closed defect (fixed)

Conversion of fig inset fails

Reported by: michael.gerz@… Owned by: dekel
Priority: high Milestone: 1.3.0
Component: lyx2lyx Version: 1.3.0cvs
Severity: critical Keywords: testcase
Cc:

Description

LyX2LyX fails to convert the attached LyX doc (created by reLyX):

Traceback (most recent call last):

File "/home/schmitt/Software/lyx-1.3.Xcvs/share/lyx/lyx2lyx/lyx2lyx", line

183, in ?

main(sys.argv)

File "/home/schmitt/Software/lyx-1.3.Xcvs/share/lyx/lyx2lyx/lyx2lyx", line

176, in main

import("lyxconvert_" + fmt).convert(header,body)

File

"/home/schmitt/Software/lyx-1.3.Xcvs/share/lyx/lyx2lyx/lyxconvert_218.py", line
494, in convert

remove_figinset(body)

File

"/home/schmitt/Software/lyx-1.3.Xcvs/share/lyx/lyx2lyx/lyxconvert_218.py", line
382, in remove_figinset

lyxwidth = string.split(lines[i])[3]+"pt"

IndexError: list index out of range

Attachments (1)

hi.lyx (448 bytes ) - added by michael.gerz@… 21 years ago.
The test case (LyX doc)

Download all attachments as: .zip

Change History (5)

by michael.gerz@…, 21 years ago

Attachment: hi.lyx added

The test case (LyX doc)

comment:1 by levon, 21 years ago

Keywords: testcase added
Milestone: 1.3.0

can you generate one from an older version of lyx itself ?

comment:2 by michael.gerz@…, 21 years ago

I don't have old LyX documents. However, I tested the very first version
of UserGuide.lyx taken from the CVS repository.

It is also in the 2.15 format (the one generated by reLyX) but it does not
have the problem.

comment:3 by michael.gerz@…, 21 years ago

Have a look at an old version of the user guide:

\begin_inset Figure size 367 158
file mobius.eps
flags 5

This is what reLyX creates:

\begin_inset Figure
file hiho.eps
flags 9

You see the difference? The "size" specification is missing!

I don't know whether this is a reLyX bug but we can easily modify the
lyx2lyx script to handle missing size specifications.

In lyxconvert_218.py, replace lines 382/383 by the following if-else construct:

if ( len(string.split(lines[i])) > 2 ):

lyxwidth = string.split(lines[i])[3]+"pt"
lyxheight = string.split(lines[i])[4]+"pt"

else:

lyxwidth = ""
lyxheight = ""

This seems to fix the bug!

comment:4 by José Matos, 21 years ago

Resolution: fixed
Status: newclosed

I have commited Michael's bugfix and I will close the bug.

Note: See TracTickets for help on using tickets.