emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* strange behavior with org-babel python
@ 2015-05-12  1:07 Doyley, Marvin M.
  2015-05-12  3:20 ` Puneeth Chaganti
  0 siblings, 1 reply; 4+ messages in thread
From: Doyley, Marvin M. @ 2015-05-12  1:07 UTC (permalink / raw)
  To: emacs-orgmode@gnu.org

Hi there,

If run the follow codes I get the following, could someone explain to me what is going wrong

(1) The desired results
#+BEGIN_SRC python :results output :exports both :session
x=5
def foo(x):
	if x>0:
		return x+1
	else:
		return x-1

print(foo(x))
#+END_SRC

#+RESULTS:
: 6

(2) No results
#+BEGIN_SRC python :results output raw :exports both 

x=5
if x>0:
	x= x+1
else:
	x= x-1
print(x)
#+END_SRC

#+RESULTS:


(3) Not sure, why I get this error
#+BEGIN_SRC python :results output raw :exports both :session

x=5
if x>0:
	x= x+1
else:
	x= x-1
print(x)
#+END_SRC

#+RESULTS:

>>> >>> >>> >>> ... ...   File "<ipython-input-5-f6e13edbe7ef>", line 3
    else:
         ^
IndentationError: unindent does not match any outer indentation level

If you want to paste code into IPython, try the %paste and %cpaste magic functions.

Thanks,
M

PS in .emacs, I have (setq org-babel-python-command "ipython --no-banner --classic --no-confirm-exit")

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-05-13 17:49 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-05-12  1:07 strange behavior with org-babel python Doyley, Marvin M.
2015-05-12  3:20 ` Puneeth Chaganti
2015-05-12  9:10   ` Doyley, Marvin M.
2015-05-13 17:49     ` Puneeth Chaganti

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).