Newbie with (possible) Spyder issue

511 views
Skip to first unread message

Stew Day

unread,
Jun 23, 2013, 7:45:53 PM6/23/13
to spyd...@googlegroups.com
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).

ufechner

unread,
Jun 24, 2013, 11:26:03 AM6/24/13
to spyd...@googlegroups.com
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

Stew Day

unread,
Jun 25, 2013, 2:35:05 AM6/25/13
to spyd...@googlegroups.com
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.

Uwe Fechner

unread,
Jun 25, 2013, 7:39:10 AM6/25/13
to spyd...@googlegroups.com
Did you try to run your script in an external interpreter?
(Menu of Spyder 2.2: Run->Configure->Execute in new, dedicated Python interpreter?)

Regards:

Uwe
--
You received this message because you are subscribed to the Google Groups "spyder" group.
To unsubscribe from this group and stop receiving emails from it, send an email to spyderlib+...@googlegroups.com.
To post to this group, send email to spyd...@googlegroups.com.
Visit this group at http://groups.google.com/group/spyderlib.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Stew Day

unread,
Jun 25, 2013, 10:20:23 PM6/25/13
to spyd...@googlegroups.com
Hi again Uwe,

I have tried your suggestion, but the result is the same.

Cheers,

Stew

Stew Day

unread,
Jun 25, 2013, 10:21:57 PM6/25/13
to spyd...@googlegroups.com
... in fact I have now completely uninstalled Python(x, y) and then reinstalled but the problem still exists!

ufechner

unread,
Jun 26, 2013, 7:50:22 AM6/26/13
to spyd...@googlegroups.com
Hi Stew,

I don't have any experiance with Python(x, y). They have their own mailing list/ forum:
https://groups.google.com/forum/#!forum/pythonxy

You could try to use WinPython instead.
(see: http://code.google.com/p/winpython/ )
It is easier to install (just unpack the downloaded
zip file in c:\ or any other directory, as long as the directory name does not contain
spaces). To avoid problem that might arise from old Python installations I would clean
the windows path variable before you launch spyder.

Please try the following from the command prompt:

c:
cd \WinPython-32bit-2.7.3.3
path=""
Spyder.exe

Change the first two lines if your winpython version is installed somewhere else,
or if you have a different version.

If this works, than create a spyder.bat file that contains the lines above.
Than you should be able to launch Spyder with a double-click on the spyder.bat
file.

This workaround is needed if there is still an old Python version in your path.

Good luck:

Uwe

Stew Day

unread,
Jun 26, 2013, 9:39:51 PM6/26/13
to spyd...@googlegroups.com
Thanks again Uwe.

I may try WinPython but I can't see that the distribution is the problem as I'm having exactly the same problem with Spyder on OSX (Anaconda distribution).

On the Anaconda mailing list I had one reply from one of the devs, Carlos Córdoba, asking me to reset Spyder from the command line. I did this and responded back to him that it was still the same but haven't heard from him again.

Looks to me like a Spyder issue but not getting much help from the Spyder team. Very frustrating!

Jed Ludlow

unread,
Jun 26, 2013, 11:51:01 PM6/26/13
to spyd...@googlegroups.com


On Wednesday, June 26, 2013 8:39:51 PM UTC-5, Stew Day wrote:
Thanks again Uwe.

I may try WinPython but I can't see that the distribution is the problem as I'm having exactly the same problem with Spyder on OSX (Anaconda distribution).

On the Anaconda mailing list I had one reply from one of the devs, Carlos Córdoba, asking me to reset Spyder from the command line. I did this and responded back to him that it was still the same but haven't heard from him again.

Looks to me like a Spyder issue but not getting much help from the Spyder team. Very frustrating!

Please consider that we are all volunteers on the project.

The error message looks very much like what would happen if you hit the debugging "Continue" icon (blue triangle pointing right) while you weren't really in a debugging session. The standard way to execute a script without debugging would be to either:
  • Hit F5
  • From the Run toolbar, click on the icon with round green circle and the running man inside (if the Run toolbar isn't visible, make is so under View>Windows and toolbars>Run toolbar).
Hope this helps,

Jed

Carlos Córdoba

unread,
Jun 27, 2013, 1:04:35 AM6/27/13
to spyd...@googlegroups.com
Jed's answer is the right one. Please read carefully the tooltips attached to every button to see what each one of them does.

Cheers,
Carlos

El 26/06/13 22:51, Jed Ludlow escribió:

Stew Day

unread,
Jun 27, 2013, 10:06:00 AM6/27/13
to spyd...@googlegroups.com
My apologies. Jed you are 100% correct.

I'm sorry I let my frustration get the better of me. I very much appreciate everyone's input. I'll be sure to pay more attention in the future to tooltips, help docs and the like before throwing my hands up and blaming the software.

Thanks again ... and sorry about the wild goose chase.

Stew

Jed Ludlow

unread,
Jun 27, 2013, 11:49:53 PM6/27/13
to spyd...@googlegroups.com
On Thursday, June 27, 2013 8:06:00 AM UTC-6, Stew Day wrote:
My apologies. Jed you are 100% correct.

I'm sorry I let my frustration get the better of me. I very much appreciate everyone's input. I'll be sure to pay more attention in the future to tooltips, help docs and the like before throwing my hands up and blaming the software.

Thanks again ... and sorry about the wild goose chase.


No worries, Stew. Happy hacking.

Jed 
Reply all
Reply to author
Forward
0 new messages