Google Groups

Re: Newbie with (possible) Spyder issue


Stew Day Jun 24, 2013 11:35 PM
Posted in group: spyder
Hi Uwe,

Thanks for your thoughts. I'm on the WinXP machine at the moment.

Under the Source menu 'Convert end of line characters' is set to windows.

It's not tab related either. If I type 'print "Hello world" in the console and then hit enter it correctly prints 'Hello world'.
If I type 'print "Hello world" in the editor, save it as test.py and then run it I get the following error:

  File "<stdin>", line 1
SyntaxError: 'continue' not properly in loop

Also I can run scripts using PyScipter on the same WinXP machine without problems. If I then try to run them with Spyder I get the above error.

Appreciate any other thoughts anyone has.

On Tuesday, 25 June 2013 01:26:03 UTC+10, ufechner wrote:
Hello,

is it possible that you have a problem with different "line-ending characters"?
Try the menu entry "convert end-of-line character" from the "source" menu
before running your script. Make sure that you use "Mac" line-endings on the
Mac and "Windows" line-endings on Windows.

Another possibility could be that you use TAB characters instead of spaces,
and the TAB-width on different computers is different. Make sure that you
use spaces only and no TAB characters. In the menu Tools->Preferences->Editor
"Advanced settings" you should have "Indentation characters: 4 spaces"
selected.

Regards:

Uwe Fechner



On Monday, June 24, 2013 1:45:53 AM UTC+2, Stew Day wrote:
Hi group,

I learned some python quite a while ago and have decided to revisit it as a tool for statistical analysis.

I installed Python(x, y) on my work machine last week (Windows XP) and, after some playing around it looks like things are working (am able to run example scripts from Allen Downey's free book ThinkPython in Spyder).

At home I run an old MacBook (OSX 10.6.8) so I have installed the Anaconda distribution. Once again, it looked like everything was working correctly.

So, I copied all the examples files and pdf of ThinkPython to a USB key so that whether I'm at home, at work or on the train, I can work through the example and get myself back up to speed with python.

When I tried to run write/run 'hello world' this morning on the train (OSX) I got the following error:

  File "<stdin>", line 1
SyntaxError: 'continue' not properly in loop

I got to work, loaded up Spyder and tried to run the same HelloWorld.py and got the same error. I also tried running some of the other scripts I was playing with last week and got the same error even those these scripts had previously run.

I still have PyScripter on my work machine, so ran HelloWorld.py using PyScripter and got Hello world at the console.

If I run debug on HelloWorld.py from Spyder I get:
>>> debugfile(r'E:\Programming\Python\ThinkPython\HelloWorld.py', wdir=r'E:\Programming\Python\ThinkPython')
> e:\programming\python\thinkpython\helloworld.py(5)<module>()
-> """
(Pdb)

(with a flashing command prompt after (Pdb))

If I then run HelloWorld.py I get:
(Pdb) continue
Hello world
>>>

But subsequent runs give the initial error.

I'm assuming this is related to Spyder, as I can run the same scripts in PyScipter without error.

Hope someone can help (apologies in advance if this is a newbie error).