Ihor Radchenko writes: > [ CCing ob-python maintainer ] > > Nasser Alkmim writes: > >> Here is a clearer description of the unwanted behavior: >> >> 1. emacs -Q ~/Desktop/testasync.org >> >> Then evaluate (require 'ob-python) and paste this source block: >> >> #+begin_src python :dir otherdir :async yes :session pysession :return figname :results file value :mkdirp yes >> import matplotlib.pyplot as plt >> plt.figure(figsize=(1, 1)) >> plt.plot([1, 2]) >> figname = 'fig.svg' >> plt.savefig(figname) >> #+end_src >> >> Execute the source block, which results in >> >> #+RESULTS: >> [[file:fig.svg]] > > I don't even see this. > Confirmed. Does the attached patch fix the issue? It seems the problem is with async sessions generally (not just ob-python), and happens because `org-babel-comint-async-filter' does not set `default-directory' before calling `org-babel-insert-result', unlike `org-babel-execute-src-block'.