summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 3bc43aa)
raw | patch | inline | side by side (parent: 3bc43aa)
author | ozmikepittman <ozmikepittman@users.sourceforge.net> | |
Thu, 24 Apr 2008 14:49:54 +0000 (14:49 +0000) | ||
committer | ozmikepittman <ozmikepittman@users.sourceforge.net> | |
Thu, 24 Apr 2008 14:49:54 +0000 (14:49 +0000) |
share/extensions/eqtexsvg.py | patch | blob | history |
index 537633e65db2505abd6e08c9d6fe824b9d95aaa4..f5e06efe8b7e38456c4f68eca4ddb4fa1a09f2f9 100644 (file)
dvi_file = os.path.join(base_dir, "eq.dvi")
svg_file = os.path.join(base_dir, "eq.svg")
out_file = os.path.join(base_dir, "eq.out")
+ err_file = os.path.join(base_dir, "eq.err")
def clean():
os.remove(latex_file)
os.remove(dvi_file)
os.remove(svg_file)
os.remove(out_file)
+ if os.path.exists(err_file):
+ os.remove(err_file)
os.rmdir(base_dir)
create_equation_tex(latex_file, self.options.formula)
sys.exit(1)
os.system('dvips -q -f -E -D 600 -y 5000 -o ' + ps_file + ' ' + dvi_file)
- #os.system('cd ' + base_dir)
- os.system('pstoedit -f plot-svg -dt -ssp ' + ps_file + ' ' + svg_file + '> ' + out_file)
+ # cd to base_dir is necessary, because pstoedit
+ # writes temporary files to cwd and needs write
+ # permissions
+ os.system('cd ' + base_dir + ' ; pstoedit -f plot-svg -dt -ssp ' + ps_file + ' ' + svg_file + ' > ' + out_file + ' 2> ' + err_file)
+
+ # forward errors to stderr but skip pstoedit header
+ if os.path.exists(err_file):
+ err_stream = open(err_file, 'r')
+ for line in err_stream:
+ if not line.startswith('pstoedit: version'):
+ sys.stderr.write(line + '\n')
+ err_stream.close()
+
svg_open(self, svg_file)
clean()