From mboxrd@z Thu Jan 1 00:00:00 1970 From: stardiviner Subject: Re: Output result of source block to a file Date: Fri, 07 Jun 2019 19:05:25 +0800 Message-ID: <8736klzmdm.fsf@gmail.com> References: <877ea041ee.fsf@gmail.com> Reply-To: numbchild@gmail.com Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:52132) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hZCqf-0005gY-UU for emacs-orgmode@gnu.org; Fri, 07 Jun 2019 07:15:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hZCqd-0003Q3-3u for emacs-orgmode@gnu.org; Fri, 07 Jun 2019 07:15:53 -0400 Received: from [183.246.138.38] (port=2069 helo=dark.localdomain) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hZCqX-0002Wc-FX for emacs-orgmode@gnu.org; Fri, 07 Jun 2019 07:15:48 -0400 In-reply-to: List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: Roger Mason Cc: emacs-orgmode@gnu.org Roger Mason writes: > Hello, > > stardiviner writes: > >> Roger Mason writes: >> >>> Hello, >>> >>> I want to output the result of the evaluation of a (python) source block >>> to a (graphics) file and have a link to the file inserted in the buffer. > >>> #+begin_src python :results value file :file scaleplot02.pdf :exports results :var data=test > > ...snip... > >>> plt.savefig(file) >>> print ("[[./%s]]" % file) >>> #+end_src > >> For this, you should try updated header arguments like ":results graphics link" >> or ":results file link". > > Thanks for your reply. > > The current incarnation: > > #+begin_src python :results graphics link :exports results :var data=test :var file="scaleplot2.pdf" > > The output: > #+RESULTS: scaleplot02 > : None > First, check out =org-manual.org= documentation. And you don't need ~print ("[[./%s]]" % file)~ in Python code if you use ~:results graphics link~. > I'm guessing I have the syntax wrong. Is it documented somewhere? I'm > on Org mode version 9.1.13 (release_9.1.13-784-ged7d1d @ > /home/rmason/.emacs.d/org-git/lisp/). > > Cheers, > Roger -- [ stardiviner ] I try to make every word tell the meaning what I want to express. Blog: https://stardiviner.github.io/ IRC(freenode): stardiviner, Matrix: stardiviner GPG: F09F650D7D674819892591401B5DF1C95AE89AC3