[Tutor] Can't find error :-(
Alan Gauld
alan.gauld at btinternet.com
Sun Aug 28 17:15:10 CEST 2011
On 28/08/11 13:34, Lisi wrote:
> On Sunday 28 August 2011 13:01:38 Peter Otten wrote:
>> Lisi wrote:
>>> Here is the error message:
>>> /usr/local/bin/AddressBook: line 6: syntax error near unexpected token
>> That's an error message by your shell. You made your script executable, but
>> forgot to add something like
>>
>> #!/usr/bin/env python
> I am very grateful to you both. I had realised that the error might be
> somewhere other than where it is indicated because Alan had already told me
> so - but had not understood that it could be, not only in a different place,
> but quite a way away.
The really important point here is that the error was a shell error not
a Python error. (You need to check the format of the message to see the
differences and get used to them) If it had been a Python error it would
typically be within a line or two of the reported place (occasionally
more but not usually) but shell errors can often be a long way off
depending on how much the file content looks like shell script...
> For future reference, how would I set about changing the encoding for just one
> character or file? I don't really want to change the encoding I use system
> wide.
Mostly you shouldn't need to for the stuff in my tutorial, I certainly
didn't use any funny characters so the default decoding should just work.
One of these days I'll add a topic on encodings but I need to really get
my own brain wrapped around it before thenm, and I'm still a bit fuzzy
in places myself!
--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
More information about the Tutor
mailing list