benyrey
Posts: 78
Joined: Tue Aug 19, 2014 7:52 pm

Idle, Idle 3 and Python games please

Fri Sep 19, 2014 7:49 pm

I just do not know what happened, but I double-click on Idle or Idle 3 or Python Games and nothing happens. It does not open anything. The rest of the icons work all OK. Any idea please. Thanks. Beny

benyrey
Posts: 78
Joined: Tue Aug 19, 2014 7:52 pm

An extra note please

Sat Sep 20, 2014 12:58 am

Sorry but I'm confused. My raspberry pi is B+, I was running the following python script:
from datetime import datetime
from time import sleep
import random
log = open("log.txt", "W")
for i in range(5):
now = str(datetime.now())
#Generate random data in the range 0-1024
data = random.randint(0, 1024)
log.write(now + " " + str(data))
print(".")
sleep(.9)
log.flush()
log.close()
May be I "fried" something. Thanks

Beny

Sleep Mode zZ
Posts: 319
Joined: Sun Aug 19, 2012 5:56 am
Location: Finland

Re: An extra note please

Sat Sep 20, 2014 6:07 am

benyrey wrote:Sorry but I'm confused. My raspberry pi is B+, I was running the following python script:

Code: Select all

from datetime import datetime
from time import sleep
import random
log = open("log.txt", "W")
for i in range(5):
    now = str(datetime.now())
    #Generate random data in the range 0-1024
    data = random.randint(0, 1024)
    log.write(now + " " + str(data))
    print(".")
    sleep(.9)
    log.flush()
    log.close()
May be I "fried" something. Thanks

Beny
I dont think that that is the problem. The usual procedure to check why some program refuses to run is to start it from the command line. Then you probably will see some error message that explains what is happening. I don't use Idle but I'm guessing that the program name to type to the command line is idle. So, open the terminal window and type the program name and press enter and see what happens. You could also try idle3, python and python3 and see what is the result. (If python starts, you can exit from it by typing exit() on the command promt and pressing enter.)

benyrey
Posts: 78
Joined: Tue Aug 19, 2014 7:52 pm

Re: Idle, Idle 3 and Python games please

Sat Sep 20, 2014 1:34 pm

Thanks a lot for your reply. Read what happens please:
-Double click on icons IDLE or IDL3 does nothing
-I open File Manager /home/pi and double click on a *.py file (a file that worked before)
the script appears on idle but then it disappears by itself

Sorry for all of this but I am not a Raspberry pi guru. I want to be.

Thanks

Beny

benyrey
Posts: 78
Joined: Tue Aug 19, 2014 7:52 pm

Re: Idle, Idle 3 and Python games please

Sat Sep 20, 2014 1:41 pm

I do not know if this will help:

=== running if from command line ===
pi@raspberrypi ~ $ idle 3

----------------------------------------
Unhandled server exception!
Thread: SockThread
Client Address: ('127.0.0.1', 57581)
Request: <socket._socketobject object at 0xb6c46ae8>
Traceback (most recent call last):
File "/usr/lib/python2.7/SocketServer.py", line 295, in _handle_request_noblock
self.process_request(request, client_address)
File "/usr/lib/python2.7/SocketServer.py", line 321, in process_request
self.finish_request(request, client_address)
File "/usr/lib/python2.7/SocketServer.py", line 334, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "/usr/lib/python2.7/idlelib/rpc.py", line 503, in __init__
SocketServer.BaseRequestHandler.__init__(self, sock, addr, svr)
File "/usr/lib/python2.7/SocketServer.py", line 649, in __init__
self.handle()
File "/usr/lib/python2.7/idlelib/run.py", line 300, in handle
from idlelib import IOBinding
File "/usr/lib/python2.7/idlelib/IOBinding.py", line 12, in <module>
import tempfile
File "/usr/lib/python2.7/tempfile.py", line 34, in <module>
from random import Random as _Random
File "random.py", line 9, in <module>
data = random.randint(0, 1024)
AttributeError: 'module' object has no attribute 'randint'

*** Unrecoverable, server exiting!
----------------------------------------
Traceback (most recent call last):
File "/usr/bin/idle", line 5, in <module>
main()
File "/usr/lib/python2.7/idlelib/PyShell.py", line 1443, in main
shell = flist.open_shell()
File "/usr/lib/python2.7/idlelib/PyShell.py", line 290, in open_shell
if not self.pyshell.begin():
File "/usr/lib/python2.7/idlelib/PyShell.py", line 1018, in begin
client = self.interp.start_subprocess()
File "/usr/lib/python2.7/idlelib/PyShell.py", line 435, in start_subprocess
self.transfer_path(with_cwd=True)
File "/usr/lib/python2.7/idlelib/PyShell.py", line 524, in transfer_path
\n""" % (path,))
File "/usr/lib/python2.7/idlelib/PyShell.py", line 734, in runcommand
self.rpcclt.remotequeue("exec", "runcode", (code,), {})
File "/usr/lib/python2.7/idlelib/rpc.py", line 216, in remotequeue
return self.asyncreturn(seq)
File "/usr/lib/python2.7/idlelib/rpc.py", line 240, in asyncreturn
response = self.getresponse(seq, wait=0.05)
File "/usr/lib/python2.7/idlelib/rpc.py", line 280, in getresponse
response = self._getresponse(myseq, wait)
File "/usr/lib/python2.7/idlelib/rpc.py", line 300, in _getresponse
response = self.pollresponse(myseq, wait)
File "/usr/lib/python2.7/idlelib/rpc.py", line 428, in pollresponse
self.handle_EOF()
File "/usr/lib/python2.7/idlelib/PyShell.py", line 348, in handle_EOF
raise EOFError
EOFError

Sleep Mode zZ
Posts: 319
Joined: Sun Aug 19, 2012 5:56 am
Location: Finland

Re: Idle, Idle 3 and Python games please

Sat Sep 20, 2014 3:17 pm

Something is obviously wrong. It seems that you started the program with the command 'idle 3', so you were starting not idle3 but the idle with an additional argument (3). But that is not the problem because on my Pi idle starts fine with that command and it just discard the argument.

Maybe if you could also try to see if python starts from the command line, because idle is a Python program and will not run if there is some problem with the Python interpreter. Maybe there is no problem with idle but with python. So try from the command line:

Code: Select all

python
and:

Code: Select all

python3
Some more knowledgeable can maybe guess from those error messages what exactly is wrong. The problem seems to be with a file called random.py. If you have created a file called 'random.py', maybe the interpreter is loading that instead of the official random module from Python's libraries?

Other than that, I would guess that somehow something has been corrupted on your Python libraries. Maybe your Pi (power or sd card) is flaky?

I would try to reinstall the programs that don't work and be watchful for other possible problems with your Pi.

dgordon42
Posts: 791
Joined: Tue Aug 13, 2013 6:55 pm
Location: Dublin, Ireland

Re: Idle, Idle 3 and Python games please

Sat Sep 20, 2014 3:53 pm

Hi,

I'm not a Pi guru either, but:

idle runs in the GUI, it will not start without a GUI running, so it will not start when entering "idle" in
a consloe. When I tried "idle" in the console, I get eror messages like the ones you posted.

Run startx, and open an LXTerminal. Try entering "idle" in the LXTerminal. It should open the idle window.

If it does not, enter "which idle" in the terminal, the reply should be:- /usr/bin/idle.

The idle icon on the Desktop is a short cut to a text file. You can rad the file by entering cat ~/Desktop/idle.desktop

This file should contain the line "Exec=/usr/bin/idle

If the Desktop Icons worked before, and then suddenly stopped, it sounds to me like you have some file system
corruption.

Hope this helps,

Dave.

Sleep Mode zZ
Posts: 319
Joined: Sun Aug 19, 2012 5:56 am
Location: Finland

Re: Idle, Idle 3 and Python games please

Sat Sep 20, 2014 4:34 pm

dgordon42 wrote:Hi,

I'm not a Pi guru either, but:

idle runs in the GUI, it will not start without a GUI running, so it will not start when entering "idle" in
a consloe. When I tried "idle" in the console, I get eror messages like the ones you posted.

Run startx, and open an LXTerminal. Try entering "idle" in the LXTerminal. It should open the idle window.

If it does not, enter "which idle" in the terminal, the reply should be:- /usr/bin/idle.

The idle icon on the Desktop is a short cut to a text file. You can rad the file by entering cat ~/Desktop/idle.desktop

This file should contain the line "Exec=/usr/bin/idle

If the Desktop Icons worked before, and then suddenly stopped, it sounds to me like you have some file system
corruption.

Hope this helps,

Dave.
I'm assuming tthat he was in the graphical desktop and tried start the programs from the LXTerminal. In the orginal post of the problem he writes about 'double-clicking,' so the original problem is present after 'startx' and and would guess that he would not log out from the desktop or use virtual consoles to try the instructions. Also he copied the error messages and for beginners it is easier to do from LXTreminal than from a mouseless console. (Actually, I don't know how to copy text from the console. :D )

KenT
Posts: 758
Joined: Tue Jan 24, 2012 9:30 am
Location: Hertfordshire, UK
Contact: Website

Re: Idle, Idle 3 and Python games please

Sat Sep 20, 2014 9:10 pm

python games does not run python but instead runs a bash script which provides a menu to select a game so its probably not python that is causing the problem

I find the Pi's double click speed is too fast/slow. Try opening the programs with right click and open

Are you logged in as user Pi. There is a bug in python games script which means you have to be

https://github.com/KenT2/python-games/pull/3
Pi Presents - A toolkit to produce multi-media interactive display applications for museums, visitor centres, and more
Download from http://pipresents.wordpress.com

benyrey
Posts: 78
Joined: Tue Aug 19, 2014 7:52 pm

Re: Idle, Idle 3 and Python games please

Sun Sep 21, 2014 2:10 pm

Dave I tried what you said, see it please:

pi@raspberrypi ~ $ which idle
/usr/bin/idle

pi@raspberrypi ~ $ cat ~/Desktop/idle.desktop
[Desktop Entry]
Name=IDLE
Comment=Integrated Development Environment for Python
Exec=/usr/bin/idle
Icon=/usr/share/pixmaps/idle.xpm
Terminal=false
MultipleArgs=false
Type=Application
Categories=Application;Development;
StartupNotify=true

I also tried rightclick/open,,, nothing opens either.

"I only know that I know nothing" Beny Socrates Rey

Thanks Dave and thanks all

benyrey
Posts: 78
Joined: Tue Aug 19, 2014 7:52 pm

Re: Idle, Idle 3 please

Sun Sep 21, 2014 2:38 pm

What does this below indicated means please?

"IDLE's subprocess didn't make connection. Either IDLE can't start a subprocess or personal firewall software is blocking the connection"

This message appears when the IDLE 3 icon opens up with Leafpad

Thanks

Beny

Sleep Mode zZ
Posts: 319
Joined: Sun Aug 19, 2012 5:56 am
Location: Finland

Re: Idle, Idle 3 and Python games please

Sun Sep 21, 2014 3:00 pm

I made a Google search and find, for an example, the following:
http://stackoverflow.com/questions/1588 ... dnt-make-c

Of interes is that some answers also mention a 'random.py' file. That came also up in your error messages and could be a clue.

benyrey
Posts: 78
Joined: Tue Aug 19, 2014 7:52 pm

Re: Idle, Idle 3 and Python games please

Sun Sep 21, 2014 4:33 pm

You saved my life!!!! Thanks... thanks and thanks

I just deleted the random.py file from /home/pi and everything is back to normal now. Both IDLE 3 and IDLE icons open the Python Shell. By the way, I got that random.py file from the book "Getting Started with Raspberry Pi" (Matt Richardson & Shawn Wallace), page 40.
To tell you the true I do not know why this problem happened. Is there a conflict with the file name (I picked it) or its content???

My email is beny@nc.rr.com. My respects
Beny

Sleep Mode zZ
Posts: 319
Joined: Sun Aug 19, 2012 5:56 am
Location: Finland

Re: Idle, Idle 3 and Python games please

Sun Sep 21, 2014 4:55 pm

The conflict is with the name. You could change the name to something else and it would not cause problems and you could run it as well. The problem with the name 'random.py' is that there is a module called 'random' built in to Python and your file called random.py gets loaded instead, overriding the built-in module. Because it can't be used in the same way as the original module, there will be problems.

I have not had this problem myself but remember that someone on this forum has warned about it. So, don't name your files with names that are in use for the built-in modules.

Return to “General discussion”