emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[BUG] Org babel python async can't return values


From: Sam Crawford
Subject: [BUG] Org babel python async can't return values
Date: Tue, 25 Jun 2024 10:14:59 +0000

This may be MacOS specific, but I noticed that :async yes only works
with :results output; :results value never returns.

A MWE is:

#+begin_src python :async yes :results value :session python
  12
#+end_src

This ought to return 12, but the "#+RESULTS:" field only ever shows
the value of the temp file

I believe the issue comes from the regexp used for
org-babel-comint-async-indicator on line 540 of ob-ipython.el. It is
currently "ob_comint_async_python_\\(.+\\)_\\(.+\\)", which means
that, if the temp file's path contains underscores (this is the bit I
believe is MacOS specific), the regex will greedily consume those
underscores, and (match-string 1) will fail to identify what type of
results we have.

I'm not too familiar with the code but, given that the first group
seems to only ever be a simple word, perhaps the replacing this regexp
with "ob_comint_async_python_\\(\\w+\\)_\\(.+\\)" would be sufficient?



reply via email to

[Prev in Thread] Current Thread [Next in Thread]