Thanks all for your help I knew it had to be crazy!
laserlight: Yes these were the only lines of code but....
Just for the heck of it I copied your code snippet into a new file and it worked!!!
So I opened another new file and typed the lines in again saved it and tried it worked!!!
Opened the original tried it it did not work! Looked at all three versions side by side for a while and could see no difference. Then I opened them in a hex editor and hey presto some unknown invisible characters 0xC2A0.
Now I think of it I started copy and pasting some example code from the web and then paired it back to a minimum when I hit problems so I assume these characters were inserted by the copyt and paste.
Removing the 0xC2A0 characters fixed the problem.
Thanks again this had bugged me all day as I successively removed chunks of code to see what caused the problem!