0

I am using the python mode. When i try to evaluate the following def using C-M-x i get this error from the python interpreter which looks strange:

def foo(*args, **kwargs): print args, kwargs >>> Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/home/amir/programming/python/tst.py", line 2 if True: ^ IndentationError: expected an indented block 

Can any one say why this happens? The file is only including the above function definition beginning from the first line an nothing more.

1 Answer 1

1

Looks like code was sent to a Python3 shell, where print is a function.

M-x py-execute-def-python2 RET should work.

Customizing py-shell-name is an option too.