On Sat, Jan 27, 2024 at 10:09:05PM +0000, José Matos wrote:

On Sat, 2024-01-27 at 20:49 +0100, didiergab...@free.fr wrote:
20:37:37.977: Exportation en cours...
20:37:37.993: (buffer-export lyxzip)
20:37:38.150: python -tt "C:/Users/Didier/AppData/Local/Programs/LyX
2.4/Resources/scripts/lyxpak.py" "K:/CPGE/PTSI/DS/DS-2023-
2024/DS3/"/"MWE-PDF preview.lyx"
20:37:38.375: Traceback (most recent call last):
20:37:38.376:   File "C:\Users\Didier\AppData\Local\Programs\LyX
2.4\Resources\scripts\lyxpak.py", line 396, in <module>
20:37:38.377:     if not argv[0].startswith("-"):
20:37:38.378:            ^^^^^^^^^^^^^^^^^^^^^^^
20:37:38.378: TypeError: startswith first arg must be bytes or a
tuple of bytes, not str
support\Systemcall.cpp (306): Systemcall: 'python -tt
"C:/Users/Didier/AppData/Local/Programs/LyX
2.4/Resources/scripts/lyxpak.py" "K:/CPGE/PTSI/DS/DS-2023-
2024/DS3/"/"MWE-PDF preview.lyx"' finished with exit code 1
Error: Conversion du fichier impossible

The problem here is that argv members are of type bytes instead of
being str (string).

This comes from the fact that the lyxpak.py script has special code to
deal with Python 2 on Windows.

@Enrico could it be that most of the specific windows code is not need
any more with Python 3?

I don't know (I don't use the native windows version). However, skipping that code when using Python3 the script fails as follows:

python -tt "C:/Program Files/LyX/Resources/scripts/lyxpak.py" "C:/work/"/"a.lyx"
Traceback (most recent call last):
  File "C:\Program Files\LyX\Resources\scripts\lyxpak.py", line 401, in <module>
    main(sys.argv)
  File "C:\Program Files\LyX\Resources\scripts\lyxpak.py", line 302, in main
    input = gzopen(lyxfile)
            ^^^^^^^^^^^^^^^
  File "C:\Program Files\LyX\Resources\scripts\lyxpak.py", line 77, in gzopen
    input = open(file.decode('utf-8'), 'rb')
                 ^^^^^^^^^^^
AttributeError: 'str' object has no attribute 'decode'. Did you mean: 'encode'?


I don't think it was ever tested on Windows with Python3.

--
Enrico
--
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel

Reply via email to