Ihor Radchenko 于2023年7月3日周一 17:28写道: > This might be a useful feature, but it will break the existing > conventions, if used as in the patch. Currently, the above combination > of :file and :results is treated as the following: > > ‘graphics’ > When used along with ‘file’ type, the result is a link to the file > specified in ‘:file’ header argument. However, unlike plain ‘file’ > type, code block output is not written to the disk. The block is > expected to generate the file by its side-effects only, as in the > following example: > > #+begin_src shell :results file link :file "org-mode-unicorn.svg" > wget -c "https://orgmode.org/resources/img/org-mode-unicorn.svg" > #+end_src > > #+RESULTS: > [[file:org-mode-unicorn.svg]] > > If ‘:file’ header argument is omitted, interpret source block > result as the file path. I have updated the patch and ‘:file’ header argument can be omitted now, e.g. #+begin_src python :results graphics file import matplotlib.pyplot as plt plt.plot([1,2,3,4,5]) plt.savefig('test.png') return 'test.png' #+end_src In this case, `graphics' can be removed too. > What if the user wants to use, for example, pyplot instead of > matplotlib? pyplot is a module of matplotlib. If you mean users want to use other graphics libraries, they may advise `org-babel-python-save-graphics' if they want to use `graphics' in the header argument. If necessary, ob-python may support such libraries too.