From a2cbebdfda1ed924eaeed673ab26a1daa91d8493 Mon Sep 17 00:00:00 2001 From: Nathaniel Nicandro Date: Wed, 24 Nov 2021 21:28:47 -0600 Subject: [PATCH] Use a raw string in :dir handling code for Python source blocks --- jupyter-python.el | 2 +- test/jupyter-test.el | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/jupyter-python.el b/jupyter-python.el index b79cc50..502382b 100644 --- a/jupyter-python.el +++ b/jupyter-python.el @@ -99,7 +99,7 @@ import os __JUPY_saved_dir = os.getcwd() os.chdir(\"%s\") try: - get_ipython().run_cell(\"\"\"%s\"\"\") + get_ipython().run_cell(r\"\"\"%s\"\"\") finally: os.chdir(__JUPY_saved_dir)" (plist-get changelist :dir) code))) diff --git a/test/jupyter-test.el b/test/jupyter-test.el index 1d597c8..a82a76f 100644 --- a/test/jupyter-test.el +++ b/test/jupyter-test.el @@ -2857,7 +2857,12 @@ os.path.abspath(os.getcwd())" (concat ": " (funcall convert-path (expand-file-name - (directory-file-name default-directory))) "\n")))))) + (directory-file-name default-directory))) "\n"))) + (ert-info ("Transformed code and backslashes") + ;; See #302 + (jupyter-org-test-src-block + "print(r\"\\r\")" + ": \\r\n"))))) (ert-deftest jupyter-org--find-mime-types () :tags '(org mime)