emacs-orgmode
[Top][All Lists]
Advanced

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

[O] strange behavior with org-babel python


From: Doyley, Marvin M.
Subject: [O] strange behavior with org-babel python
Date: Tue, 12 May 2015 01:07:25 +0000

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




reply via email to

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