emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[O] Adding custom arguments to org-babel src code eval


From: Dushyant Juneja
Subject: [O] Adding custom arguments to org-babel src code eval
Date: Thu, 03 Aug 2017 17:42:45 +0000

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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]