From 69c6b4188dcdd74e48b6c80471336811779d9862 Mon Sep 17 00:00:00 2001 From: Florian Festi Date: Thu, 13 Sep 2018 10:15:22 +0200 Subject: [PATCH] Jupyter notebook example: Use temp file --- scripts/boxes_example.ipynb | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/scripts/boxes_example.ipynb b/scripts/boxes_example.ipynb index 9dbc2b5..ec55b5d 100644 --- a/scripts/boxes_example.ipynb +++ b/scripts/boxes_example.ipynb @@ -13,11 +13,12 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 4, "metadata": {}, "outputs": [], "source": [ "from IPython.display import SVG, display\n", + "import tempfile, os\n", "\n", "import sys\n", "#sys.path.append('/PATH/TO/boxes') # uncomments and adjust if your Boxes.py copy in not in the Python path\n", @@ -26,7 +27,7 @@ }, { "cell_type": "code", - "execution_count": 27, + "execution_count": 8, "metadata": { "scrolled": true }, @@ -35,7 +36,7 @@ "data": { "image/svg+xml": [ "\n", - "\n", + "\n", "\n", "\n", "\n", @@ -112,10 +113,13 @@ " self.close()\n", "\n", "b = Example()\n", - "b.parseArgs(['--reference=0', '--debug=0'])\n", + "fd, fn = tempfile.mkstemp()\n", + "b.parseArgs(['--reference=0', '--debug=0', '--output=' + fn])\n", "b.render()\n", "\n", - "display(SVG(b.output))" + "display(SVG(fn))\n", + "os.close(fd)\n", + "os.remove(fn)" ] }, {