Skip to content

Commit 932f3c1

Browse files
eric-wieserutensil
authored andcommitted
Propagate python tracebacks in LaTeX.ipynb (#160)
1 parent ca66680 commit 932f3c1

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

examples/ipython/LaTeX.ipynb

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,15 @@
1414
"os.chdir('../LaTeX')\n",
1515
"\n",
1616
"def check(name):\n",
17-
" subprocess.check_call([sys.executable, name + '.py'])\n",
17+
" # todo: use subprocess.run once we drop Python 2.7\n",
18+
" p = subprocess.Popen([sys.executable, name + '.py'], stderr=subprocess.PIPE, universal_newlines=True)\n",
19+
" try:\n",
20+
" stdout, stderr = p.communicate()\n",
21+
" except:\n",
22+
" p.kill()\n",
23+
" if p.poll():\n",
24+
" raise RuntimeError(\"The script raised an exception:\\n\\n\" + stderr)\n",
25+
"\n",
1826
" with open(name + '.tex', 'r') as f:\n",
1927
" # can't use display.Latex here, it would result in CSS comparisons in the output.\n",
2028
" \n",

0 commit comments

Comments
 (0)