I am running Mac OS 10.6.4...I know this is embarrassingly simple, but I've spent hours on this. I'm beginning to think there might be an installation problem with Python. I stupidly removed MacPython from my Applications file, then when I realized what I had done, downloaded and installed Python2.6.6
Using IDLE, I created test.py. File attached.
In a terminal window, after chmod +x test.py and then ./test.py, I get this error: syntax error near unexpected token `('
Here is the complete contents of the terminal window:
Last login: Tue Sep 21 12:49:02 on ttys000
mjmmacbook:~ michaelmullin$ chmod +x test.py
mjmmacbook:~ michaelmullin$ ./test.py
./test.py: line 1: syntax error near unexpected token `('
./test.py: line 1: `Python 2.6.6 (r266:84374, Aug 31 2010, 11:00:51) '
mjmmacbook:~ michaelmullin$
I get the same error even when the .py file contains a real script (downloaded from web and tested by many)
Including #!/usr/bin/env python2.6.6 (or just ...python) does not change the error.
I've been thinking about reloading my operating system, but not sure that will help and its a little radical.
I hope someone can get me on track.
Many Thanks,
Michael
Using IDLE, I created test.py. File attached.
In a terminal window, after chmod +x test.py and then ./test.py, I get this error: syntax error near unexpected token `('
Here is the complete contents of the terminal window:
Last login: Tue Sep 21 12:49:02 on ttys000
mjmmacbook:~ michaelmullin$ chmod +x test.py
mjmmacbook:~ michaelmullin$ ./test.py
./test.py: line 1: syntax error near unexpected token `('
./test.py: line 1: `Python 2.6.6 (r266:84374, Aug 31 2010, 11:00:51) '
mjmmacbook:~ michaelmullin$
I get the same error even when the .py file contains a real script (downloaded from web and tested by many)
Including #!/usr/bin/env python2.6.6 (or just ...python) does not change the error.
I've been thinking about reloading my operating system, but not sure that will help and its a little radical.
I hope someone can get me on track.
Many Thanks,
Michael
Comment