From: Scott Kostyshak Date: Fri, 30 Aug 2019 00:48:34 +0000 (-0400) Subject: Port gnuplot2pdf.py to Python 3 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=c7d8ca160063a9da1ca713c62f4b8748e6258f59;p=features.git Port gnuplot2pdf.py to Python 3 Instead of wait(), use communicate(), as mentioned here: https://docs.python.org/3/library/subprocess.html Otherwise, the process seems to hang as cautioned in the above URL. Also, use byte strings. --- diff --git a/lib/scripts/gnuplot2pdf.py b/lib/scripts/gnuplot2pdf.py index fb036b2df5..e7246a3dea 100755 --- a/lib/scripts/gnuplot2pdf.py +++ b/lib/scripts/gnuplot2pdf.py @@ -11,7 +11,7 @@ if (len(argv) != 3): with open(argv[1], 'rb') as fsrc: subproc = Popen("gnuplot", shell=True, stdin=PIPE) - subproc.stdin.write("set terminal pdf\nset output '%s'\n" % argv[2]) + subproc.stdin.write(b"set terminal pdf\nset output '%s'\n" % argv[2].encode()) shutil.copyfileobj(fsrc, subproc.stdin) - subproc.stdin.write("exit\n") - subproc.wait() + subproc.stdin.write(b"exit\n") + subproc.communicate()