Issues with SPE


5 posts
by TheWhaleys » Fri Nov 02, 2012 10:06 pm
Trying to set-up SPE so my 12-y-o daughter can try out some simple programming. Several frustrations hence this is a multi-question post

Q1) When I launch SPE the CPU indicator whams up to 100% - is this really such a CPU hog ? This happens even just opening the editor.

Q2) When downloaded a 'snake' game and tried to run within SPE .. it came up with an obscure error in a routine which is not even within the 'snake' game - something like nocbreak() within wrapper.py returned ERR. Any ideas ?

Q3) I found somewhere on the internet (sorry author for not crediting you) a plausible looking very simple hangman game. Typed into SPE.

3a) When I 'run' from within SPE it starts OK, and types the 1st bit of output, then it sits there waiting for the user (me !) to input a letter. I cannot get the blessed thing to accept any input. Except CTRL-R ! which it will happily axe the script on. Is there some magic I am missing which allows one to input to the shell ?

3b) The commands to open Terminal and/or to run the script in a Terminal window (which sounds to me like a better way forward) produce no results at all. Nothing happens, neither a busy indicator nor any sign of output. Any ideas how to run the script in a Terminal window ?

4) Am I limited to SPE ? Are there other (perhaps simpler) editing and execution environments ? Am happy with a text editor and command line if someone can teach me the magic words. I saw there is another thing in the Debian Gnome environment called WinPDB, but that seems even more impenetrable than SPE and will leave it well alone.

TIA for any helpful guidance.

Eoin
Posts: 3
Joined: Fri Nov 02, 2012 9:39 pm
by TheWhaleys » Fri Nov 02, 2012 11:06 pm
Actually being logging this cri de coeur and it being approved I found out :

- using the #! usr/bin/Python and chmod +x myscript.py allows one to run a script through terminal.

- for input one have to use 'x' rather than x otherwise the script thinks one is trying out a new variable (not sure if that is weakness in the way the script is written).

- so at least I can get the simple hangman thing going which is re-assuring.

- Would still like to know any ideas on the SPE CPU hogging etc, realised too late (just shut down the RPi for the night), the version numbers - I think it the SPE is something like 0.8.44 and it is on whatever version of Debian that came with the RPi last July (it has taken a while to get it up and running), though... I did an update last week .. so maybe it is not quite the stock version that was on the SD card.

Cheers

Eoin
Posts: 3
Joined: Fri Nov 02, 2012 9:39 pm
by BlackJack » Fri Nov 02, 2012 11:19 pm
@TheWhaleys: The 'x' problem is because the script uses `input()` in Python 2. It shouldn't. `raw_input()` is the safe and sound function for user input.
Code: Select all
while not self.asleep():
    sheep += 1
Posts: 288
Joined: Sat Aug 04, 2012 8:28 am
by TheWhaleys » Sat Nov 03, 2012 11:19 pm
Thanks Blackjack,

raw_input() is a good tip !

I also used the #! /usr/bin/env python and chmod +x myscript to make the scipt executable in a terminal window.

Then set up SPE in 1 desktop window and a terminal session in the other window, and viola ! my 12-y-o is happily hacking the snake game in SPE in win-1 and then trying out the results straight away in win-2.

Happy campers all, though I'd still like to know more about why SPE takes up (or seems to take up) so much CPU.

Cheers

Eoin
Posts: 3
Joined: Fri Nov 02, 2012 9:39 pm
by texy » Mon Nov 05, 2012 12:57 pm
WRT SPE, which distro are you using? For a while now, the raspbian distro's have IDLE and IDLE3 as a python and python3 IDE shortcuts on the desktop in X.
Its works well, maybe you should try it.

Regards,
Texy
"2.8inch TFT LCD + Touch screen" add-on boards for sale here :
http://www.raspberrypi.org/phpBB3/viewtopic.php?f=93&t=65566
50p goes to the Foundation ;-)
Forum Moderator
Forum Moderator
Posts: 2313
Joined: Sat Mar 03, 2012 10:59 am
Location: Berkshire, England