On Monday 02 March 2015 18:26:52 Kornel Benko wrote:
> To reproduce:
> 
> Open new file 'xxx.lyx'
> write xxx
> File->Export->LyX 2.1.x
> 
> ==> An error occurred while runnig:
>       python -tt xxxxxxxx
> 
> Calling manually I get
> 
>       # python -tt /usr/local/lyx2.2/lyx2lyx/lyx2lyx -t 474 xxx.lyx
>       Warning: An error ocurred in 481, <function revert_phrases at 
> 0x7feba3d40ed8>
>       Traceback (most recent call last):
>         File "/usr/local/lyx2.2/lyx2lyx/lyx2lyx", line 86, in <module>
>           main()
>         File "/usr/local/lyx2.2/lyx2lyx/lyx2lyx", line 80, in main
>           doc.convert()
>         File "/usr9/local/lyx2.2/lyx2lyx/LyX.py", line 564, in convert
>           conv(self)
>         File "/usr9/local/lyx2.2/lyx2lyx/lyx_2_2.py", line 618, in 
> revert_phrases
>           if len(words) > 1 and words[0] == "\\begin_inset" and \
>       NameError: global name 'words' is not defined
>       Exit 1
> 
> In fact, it suffices to change manually '\lyxformat 485' to '\lyxformat 474' 
> in xxx.lyx.
> 
>       Kornel

Without testing I expect this patch to fix that.

Regards,
-- 
José Abílio
diff --git a/lib/lyx2lyx/lyx_2_2.py b/lib/lyx2lyx/lyx_2_2.py
index 59f32c4..82f12e2 100644
--- a/lib/lyx2lyx/lyx_2_2.py
+++ b/lib/lyx2lyx/lyx_2_2.py
@@ -615,6 +615,7 @@ def revert_phrases(document):
 
     i = 0
     while i < len(document.body):
+        words = document.body[i].split()
         if len(words) > 1 and words[0] == "\\begin_inset" and \
            words[1] in ["CommandInset", "External", "Formula", "Graphics", "listings"]:
             # see convert_phrases

Reply via email to