The current script fails for me. The attached patch seems to work, but I
only got it to work by experimenting. Can any Pythonista take a close
look? With the wait() command it seems to hang, so I substituted
communicate() as mentioned here:

  https://docs.python.org/3/library/subprocess.html 

Thanks,

Scott
From c7c3aca52ea05d9c176a07d0149a77ca456e95d4 Mon Sep 17 00:00:00 2001
From: Scott Kostyshak <skost...@lyx.org>
Date: Thu, 29 Aug 2019 20:48:34 -0400
Subject: [PATCH] Port gnuplot2pdf.py to Python 3

Instead of wait(), use communicate(), as mentioned here:

  https://docs.python.org/3/library/subprocess.html
---
 lib/scripts/gnuplot2pdf.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

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()
-- 
2.20.1

Attachment: signature.asc
Description: PGP signature

Reply via email to