2020-10-30 18:46:13 +00:00
|
|
|
#!/usr/bin/python3
|
2016-10-17 06:44:16 +00:00
|
|
|
|
|
|
|
from subprocess import Popen, PIPE
|
|
|
|
from sys import argv, stderr, exit
|
|
|
|
import shutil
|
|
|
|
|
|
|
|
if (len(argv) != 3):
|
|
|
|
stderr.write("Usage: %s <src_file> <dst_file>\n" % argv[0])
|
|
|
|
exit(1)
|
|
|
|
|
|
|
|
with open(argv[1], 'rb') as fsrc:
|
|
|
|
subproc = Popen("gnuplot", shell=True, stdin=PIPE)
|
2019-08-30 00:48:34 +00:00
|
|
|
subproc.stdin.write(b"set terminal pdf\nset output '%s'\n" % argv[2].encode())
|
2016-10-17 06:44:16 +00:00
|
|
|
shutil.copyfileobj(fsrc, subproc.stdin)
|
2019-08-30 00:48:34 +00:00
|
|
|
subproc.stdin.write(b"exit\n")
|
|
|
|
subproc.communicate()
|