从 Windows 切换到 Mac 后,我的 python org-mode 代码块的输出无法正常工作。它不断打印似乎是后端 python 调用的内容,甚至没有完整的命令,似乎缩短了命令(如下面的示例所示,结果在输入 python“print”命令之前停止)。
代码按预期执行,结果打印在交互式 python 会话缓冲区中(尽管顶部仍然有烦人的后端调用)。但是,它没有被附加到组织模式缓冲区本身中。有关如何做的任何提示
这是示例代码:
#+BEGIN_SRC python :python python3 :session py :results output :noweb yes :tangle no
print("Somehow the output of these source blocks are not displayed correctly? I did not have this issue with emacs on Windows...")
#+END_SRC
#+RESULTS:
: __PYTHON_EL_eval("try:\n with open('/var/folders/ty/x6hl83sn5cz667zpq3yk02lr0000gn/T/babel-PJfJby/python-HFmx85') as __org_babel_python_tmpfile:\n exec(compile(__org_babel_python_tmpfile.read(), __org_babel_python_tmpfile.name, 'exec'))\nexcept:\n raise\nfinally:\n print('
这就是它在交互式 python 缓冲区中的样子:
__PYTHON_EL_eval_file("/var/folders/ty/x6hl83sn5cz667zpq3yk02lr0000gn/T/py66QmoC", "/var/folders/ty/x6hl83sn5cz667zpq3yk02lr0000gn/T/py66QmoC", True)
Somehow the output of these source blocks are not displayed correctly? I did not have this issue with emacs on Windows...
org_babel_python_eoe
>>>
在 macOS Sonoma 14.4 上运行 Emacs 29.4
我尝试设置 :results 值,该值按预期返回“None”。我注意到这不会打印后端字符串。
编辑: 有人指出这个线程并按照 Ian 提供的步骤修复了 iussue ✅ https://emacs.stackexchange.com/questions/81683/python-org-babel-having-garbled-result