Re: Error when exporting to LyX Archive (zip)

2023-12-06 Thread José Matos
On Wed, 2023-12-06 at 16:37 +0100, kzsta...@gmail.com wrote:
> When exporting to  LyX Archive (zip) in LyX-2.4.0-beta5 on Windows-
> 11, I get the message “Cannot convert file”; see the attached screen
> print. It appears that this is caused by the use of xrange in
> lyxpak.py; see the attached part of the log file of LyX running as
> lyx -dbg all.  In LyX-2.3.7, exporting works fine.
> LyX-2.3 uses Python2, and LyX-2.4 uses Python3. In Python3, xrange
> has been removed, and replaced by an extended version of range; see
> https://docs.python.org/3/whatsnew/3.0.html#views-and-iterators-instead-of-lists
>  
> Kees

You are right. :-)

The fix is quite simple as you suggest, replace xrange with range.

One small note about the above, 2.4 can still work with Python 2.
Fortunately, in this regard, the above change is compatible with Python
2 and so it is the correct, and safe, choice to apply to LyX 2.4.

I took this opportunity to check for other occurrences of xrange in 2.4
and that was the last case.
-- 
José Abílio
-- 
lyx-users mailing list
lyx-users@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-users


Error when exporting to LyX Archive (zip)

2023-12-06 Thread kzstatis
When exporting to  LyX Archive (zip) in LyX-2.4.0-beta5 on Windows-11, I get
the message "Cannot convert file"; see the attached screen print. It appears
that this is caused by the use of xrange in lyxpak.py; see the attached part
of the log file of LyX running as lyx -dbg all.  In LyX-2.3.7, exporting
works fine.

LyX-2.3 uses Python2, and LyX-2.4 uses Python3. In Python3, xrange has been
removed, and replaced by an extended version of range; see
https://docs.python.org/3/whatsnew/3.0.html#views-and-iterators-instead-of-l
ists

 

Kees

 

 

 



testxp.lyx
Description: application/lyx
BufferParams.cpp (Undo.cpp330): Checking whether document is in a system dir... 
( no
596): --- End of group 7 of buffer 014A8D7EEF00support\FileName.cpp 
(629): Checksumming "
F:/Users/Kees/Documenten/Papers/LyX/Test/Pak/testxp.lyx" 3132205323 lasted 2 ms.
BufferView.cpp (3555Converter.cpp (527): Converting from  lyx to lyxzip
):  *** START DRAWING ***Converter.cpp (681): Calling python -tt 
$$s/scripts/lyxpak.py 
"F:/Users/Kees/Documenten/Papers/LyX/Test/Pak/"/"testxp.lyx"

BufferView.cpp (3600): Strategy: FullScreenUpdate
support\Systemcall.cpp (TextMetrics.cpp265): Running: python -tt "C:/Program 
Files/LyX 2.4/Resources/scripts/lyxpak.py" 
"F:/Users/Kees/Documenten/Papers/LyX/Test/Pak/"/"testxp.lyx"
 (2120): main text redraw pit=0 row=0 full_repaint
BufferView.cpp (3624):   *** END DRAWING ***
BufferView.cpp (611):  Updating scrollbar: height: 1 curr par: 0 default height 
25
BufferView.cpp (627): storing height for pit 0 : 73
Traceback (most recent call last):
  File "C:\Program Files\LyX 2.4\Resources\scripts\lyxpak.py", line 393, in 

argv = [argv_unicode[i].encode('utf-8') for i in xrange(1, argc.value)]
 ^^
NameError: name 'xrange' is not defined. Did you mean: 'range'?
support\Systemcall.cpp (306): Systemcall: 'python -tt "C:/Program Files/LyX 
2.4/Resources/scripts/lyxpak.py" 
"F:/Users/Kees/Documenten/Papers/LyX/Test/Pak/"/"testxp.lyx"' finished with 
exit code 1
Error: Cannot convert file
-- 
lyx-users mailing list
lyx-users@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-users