Saturday, January 18, 2014

UNIX bash shell and interactive Python shell

http://forums.macrumors.com/showthread.php?t=477303

type your command at the SHELL PROMPT not Python interpreter prompt: open Terminal, 'cd' to your python script directory and type

Code:
$ python spam.py
If you want to execute python module in the interactive Python shell:
start python by typing
$ python
and type
Code:
>>> import spam
without '.py' file extension.

Your problems originates in mixing UNIX bash shell and interactive Python shell.