From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dushyant Juneja Subject: Adding custom arguments to org-babel src code eval Date: Thu, 03 Aug 2017 17:42:45 +0000 Message-ID: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="001a11469f6a1df4c00555dce90a" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:53744) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ddK9C-0002yZ-MV for emacs-orgmode@gnu.org; Thu, 03 Aug 2017 13:42:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ddK9B-00036k-Ow for emacs-orgmode@gnu.org; Thu, 03 Aug 2017 13:42:58 -0400 Received: from mail-wm0-x235.google.com ([2a00:1450:400c:c09::235]:34866) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ddK9B-00035D-H1 for emacs-orgmode@gnu.org; Thu, 03 Aug 2017 13:42:57 -0400 Received: by mail-wm0-x235.google.com with SMTP id m85so1330534wma.0 for ; Thu, 03 Aug 2017 10:42:57 -0700 (PDT) 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: emacs-org list --001a11469f6a1df4c00555dce90a Content-Type: text/plain; charset="UTF-8" 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: 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 --001a11469f6a1df4c00555dce90a Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi,

Is it possible to add custom argume= nts to source code evaluation in org babel? For example, if the source code= block is:

#+BEGIN_S= RC python=C2=A0
# valid comment 1=
print("Hi there!") # v= alid comment 2
print("# Inva= lid 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
=C2=A0--- modulename: notes, funcname: <module>
notes.py(2): print("Hi there!") = # valid comment 2
Hi there!
notes.py(3): print("# Invalid com= ment! #UsefulForHashtags!")
= # Invalid comment! #UsefulForHashtags!
notes.py(4): print ("Space is fine here!")
Space is fine here!
=C2=A0--- modulename: trace, funcname: _unsettrace
trace.py(77): =C2=A0 =C2=A0 =C2=A0 =C2=A0 = sys.settrace(None)

So far, I know I c= an 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 t= ried :cmdline and :args "-m trace --trace", and neither seem to w= ork.

Any ideas?

Dushyant<= /div>



--001a11469f6a1df4c00555dce90a--