From: Dushyant Juneja <juneja.dushyant@gmail.com>
To: emacs-org list <emacs-orgmode@gnu.org>
Subject: Adding custom arguments to org-babel src code eval
Date: Thu, 03 Aug 2017 17:42:45 +0000 [thread overview]
Message-ID: <CAJkb0UNJpWfVbz-405sPeSg7MMBOHHDg-7Pv8WoSQdp82wUi6A@mail.gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 1275 bytes --]
Hi,
Is it possible to add custom arguments to source code evaluation in org
babel? For example, if the source code block is:
#+BEGIN_SRC python
# valid comment 1
print("Hi there!") # valid comment 2
print("# Invalid comment! #UsefulForHashtags!")
print ("Space is fine here!")
#+END_SRC
The general C-c C-c will evaluate it using the python interpreter. Hence
the result:
#+RESULTS:
: Hi there!
: # Invalid comment! #UsefulForHashtags!
: Space is fine here!
However, I would like to pass '-m trace --trace' arguments to the
interpreter, so that the resulting text capture is basically an output of
the following command:
> python -m trace --trace notes.py
--- modulename: notes, funcname: <module>
notes.py(2): print("Hi there!") # valid comment 2
Hi there!
notes.py(3): print("# Invalid comment! #UsefulForHashtags!")
# Invalid comment! #UsefulForHashtags!
notes.py(4): print ("Space is fine here!")
Space is fine here!
--- modulename: trace, funcname: _unsettrace
trace.py(77): sys.settrace(None)
So far, I know I can do this via #+call syntax and a custom shell script.
However, that looks like an overkill for passing simple arguments to the
interpreter. I have tried :cmdline and :args "-m trace --trace", and
neither seem to work.
Any ideas?
Dushyant
[-- Attachment #2: Type: text/html, Size: 2507 bytes --]
reply other threads:[~2017-08-03 17:42 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=CAJkb0UNJpWfVbz-405sPeSg7MMBOHHDg-7Pv8WoSQdp82wUi6A@mail.gmail.com \
--to=juneja.dushyant@gmail.com \
--cc=emacs-orgmode@gnu.org \
/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).