From 16655c00e0a84f6bfe58870c918fbfc016fe58ec Mon Sep 17 00:00:00 2001 From: jaseg Date: Mon, 30 Jun 2025 15:35:25 +0200 Subject: Fix hugo layout in hugo > ~0.130.0 For some reason, newer hugo versions have trouble with .summary, and on some pages where .summary is not defined in the page header metadata, when rendering the page as a preview card, hugo swallows the card's closing tag. Such a weird bug, we now just work around it by explicitly setting the .summary meta on pages that cause this bug(?) to surface. --- .../jupyterlab_notebook_file_oneliner/index.rst | 21 --------------------- 1 file changed, 21 deletions(-) delete mode 100644 content/blog/jupyterlab_notebook_file_oneliner/index.rst (limited to 'content/blog/jupyterlab_notebook_file_oneliner') diff --git a/content/blog/jupyterlab_notebook_file_oneliner/index.rst b/content/blog/jupyterlab_notebook_file_oneliner/index.rst deleted file mode 100644 index 8885c4c..0000000 --- a/content/blog/jupyterlab_notebook_file_oneliner/index.rst +++ /dev/null @@ -1,21 +0,0 @@ ---- -title: "Getting the .ipynb Notebook File Location From a Running Jupyter Lab Notebook" -date: 2025-06-30T23:42:00+01:00 -summary: > - If you need to get the path of the ipynb file in a running #Jupyter notebook, this one-liner will do the trick. It - seems chatgpt is confused, and a bunch of other approaches on the web look fragile and/or unnecessarily complex to - me. ---- - -If you need to get the path of the ipynb file in a running #Jupyter notebook, this one-liner will do the trick. It seems -chatgpt is confused, and a bunch of other approaches on the web look fragile and/or unnecessarily complex to me. - -.. code:: python - - import sys - Path(json.loads(Path(sys.argv[-1]).read_bytes())['jupyter_session']) - -The way this works is that for each notebook, jupyter starts a python "kernel" process that actually runs the notebook's -code. That kernel gets a json file with info on the notebook's location on the disk passed through its command line. -Since we're running code in that exact python process, we can just grab that json file from sys.argv, and read it -ourselves. -- cgit