Skip to content

Commit a2cbebd

Browse files
committed
Use a raw string in :dir handling code for Python source blocks
1 parent 724d03e commit a2cbebd

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

jupyter-python.el

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ import os
9999
__JUPY_saved_dir = os.getcwd()
100100
os.chdir(\"%s\")
101101
try:
102-
get_ipython().run_cell(\"\"\"%s\"\"\")
102+
get_ipython().run_cell(r\"\"\"%s\"\"\")
103103
finally:
104104
os.chdir(__JUPY_saved_dir)"
105105
(plist-get changelist :dir) code)))

test/jupyter-test.el

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2857,7 +2857,12 @@ os.path.abspath(os.getcwd())"
28572857
(concat ": "
28582858
(funcall convert-path
28592859
(expand-file-name
2860-
(directory-file-name default-directory))) "\n"))))))
2860+
(directory-file-name default-directory))) "\n")))
2861+
(ert-info ("Transformed code and backslashes")
2862+
;; See #302
2863+
(jupyter-org-test-src-block
2864+
"print(r\"\\r\")"
2865+
": \\r\n")))))
28612866

28622867
(ert-deftest jupyter-org--find-mime-types ()
28632868
:tags '(org mime)

0 commit comments

Comments
 (0)