From: Karl Voit <devnull@Karl-Voit.at>
To: emacs-orgmode@gnu.org
Subject: Re: [babel] sbe not working properly (resolved)
Date: Sat, 13 Apr 2013 10:01:21 +0200 [thread overview]
Message-ID: <2013-04-13T09-58-32@devnull.Karl-Voit.at> (raw)
In-Reply-To: m2wqs8vpya.fsf@christianmoe.com
* Christian Moe <mail@christianmoe.com> wrote:
>
> Hi,
Hi!
> I cannot replicate Karl's problem. I copied the code examples, and got
> the right results on Org 8.0-pre (pulled this morning).
>
> I did have to make one change -- Babel wouldn't recognize the variables
> until I passed them with :var rather than in parens after the codeblock
> name. (I saw there was some discussion on dropping the latter syntax;
> whoa -- has it already happened?)
I can confirm that using the :var syntax, it is working properly:
#+NAME: epoch2day
#+BEGIN_SRC python :results output :var epoch=1262675465119
time = epoch
import datetime
strtime = str(time)
datetimestamp = datetime.datetime.utcfromtimestamp(int(strtime[:10]))
print datetimestamp.strftime('[%Y-%m-%d %a %H:%M:%S]')
#+END_SRC
#+RESULTS: epoch2day
: [2010-01-05 Tue 07:11:05]
| epoch | day |
|---------------+---------------------------|
| 1262675465119 | [2010-01-05 Tue 07:11:05] |
| 123456 | [1970-01-02 Fri 10:17:36] |
| 99998754 | [1973-03-03 Sat 09:25:54] |
#+TBLFM: $2='(sbe epoch2day (epoch $1))
... works (and enriches my Org-mode capabilities enourmously! :-).
#+name: add1
#+begin_src python :results silent :var x=1
return x + 1
#+end_src
#+RESULTS: add1
: 2
| foo | bar | 3 | 4 |
#+TBLFM: @1$4='(sbe add1 (x $3))
... does work as well.
Thanks for pointing me to the change of syntax.
--
mail|git|SVN|photos|postings|SMS|phonecalls|RSS|CSV|XML to Org-mode:
> get Memacs from https://github.com/novoid/Memacs <
https://github.com/novoid/extract_pdf_annotations_to_orgmode + more on github
prev parent reply other threads:[~2013-04-13 8:01 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-11 14:26 [babel] sbe not working properly Karl Voit
2013-04-11 18:00 ` Darlan Cavalcante Moreira
2013-04-11 19:15 ` Christian Moe
2013-04-12 22:22 ` Eric Schulte
2013-04-13 8:01 ` Karl Voit [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2013-04-13T09-58-32@devnull.Karl-Voit.at \
--to=devnull@karl-voit.at \
--cc=emacs-orgmode@gnu.org \
--cc=news1142@Karl-Voit.at \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).