]> git.lyx.org Git - lyx.git/blobdiff - lib/scripts/svg2pstex.py
Fix grammar
[lyx.git] / lib / scripts / svg2pstex.py
index 246537b6ec6fe6946c5d3a7bee71ba3e70184772..ef6ff1d92c22f26ca2c999230d8b97a144ba91ad 100644 (file)
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/python3
 # -*- coding: utf-8 -*-
 
 # file svg2pstex.py
 # This script converts an SVG image to something that latex can process
 # into high quality PostScript.
 
+from __future__ import print_function
+
 import os, sys, re, subprocess
 
 def runCommand(cmd):
     ''' Utility function:
         run a command, quit if fails
     '''
-    if subprocess.call(cmd) != 0:
-        print "Command '%s' fails." % cmd
+    res = subprocess.check_call(cmd)
+    if res != 0:
+        print("Command '%s' fails (exit code: %i)." % (res.cmd, res.returncode))
         sys.exit(1)
 
 InkscapeCmd = "inkscape"
@@ -68,7 +71,7 @@ OutBase = os.path.splitext(OutputFile)[0]
 # while outsourcing the text to a LaTeX file ${OutBase}.eps_tex which includes and overlays
 # the EPS image and can be \input to LaTeX files. We rename the latter file to ${OutputFile}
 # (although this is probably the name it already has).
-runCommand([InkscapeCmd, '--file=%s' % (InputFile), '--export-eps=%s.eps' % (OutBase), '--export-latex'])
+runCommand([r'%s' % InkscapeCmd, '--file=%s' % InputFile, '--export-eps=%s.eps' % OutBase, '--export-latex'])
 
 os.rename('%s.eps_tex' % OutBase, OutputFile)