On Thu, 2024-04-11 at 21:38 +0200, Tobias Hilbricht wrote:
> graphics/GraphicsConverter.cpp (288): build_script ... 
> graphics/GraphicsConverter.cpp (414): ready!
> graphics/GraphicsConverter.cpp (150):         Conversion script:
> --------------------------------------
> # -*- coding: utf-8 -*-
> import os, shutil, sys
> 
> def unlinkNoThrow(file):
>   ''' remove a file, do not throw if an error occurs '''
>   try:
>     os.unlink(file)
>   except:
>     pass
> 
> infile = "/home/tobias/Dokumente/Privat/DocCentral/LaTeX/LyX/gnuplot-
> example.gp"
> outfile = "/tmp/lyx_tmpdir.qIGrrVZsvWmq/gconvertYrusMn.gp"
> shutil.copy(infile, outfile)
> os.chdir("/tmp/lyx_tmpdir.qIGrrVZsvWmq/")
> infile = "/tmp/lyx_tmpdir.qIGrrVZsvWmq/gconvertYrusMn.gp"
> infile_base = "/tmp/lyx_tmpdir.qIGrrVZsvWmq/gconvertYrusMn"
> outfile = "/tmp/lyx_tmpdir.qIGrrVZsvWmq/gconvertYrusMn.pdf"
> outdir  = os.path.dirname(outfile)
> 
> if os.system(r'$${python} "/usr/local/share/lyx-

The problem is here $${python} is not converted when we create the
script.

For the moment a way to get around this is in

Tools->Preferences->File Handling->Converters
Gnuplot -> PDF (graphics)

Converter: $${python} $$s/scripts/gnuplot2pdf.py $$i $$o

move that to

Converter: python3 $$s/scripts/gnuplot2pdf.py $$i $$o

> 2.4.0~RC4/scripts/gnuplot2pdf.py" ' + '"' + infile + '"' + ' ' + '"'
> +
> outfile + '"' + '') != 0:
>   unlinkNoThrow(outfile)
>   sys.exit(1)
> 
> if not os.path.isfile(outfile):
>   if os.path.isfile(outfile + '.0'):
>     os.rename(outfile + '.0', outfile)
>     import glob
>     for file in glob.glob(outfile + '.?'):
>       unlinkNoThrow(file)
>   else:
>     sys.exit(1)
> 
> if infile != outfile:
>   unlinkNoThrow(infile)

The real fix is one line of code. :-)
I will do it later today.

-- 
José Abílio
-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel

Reply via email to