Python won't run

Ned Deily nad at acm.org
Mon Feb 23 18:01:00 EST 2009


[Again, please reply-all to the list, don't send private email!]

On Feb 23, 2009, at 14:03 , kevin hayes wrote:
> Ned, system log didn't do anything when I tried to open IDLE. However, this 
> is what's in the console.log. does this tell you anything?
> 
> Unhandled server exception!
> Thread: SockThread
> Client Address:  ('127.0.0.1', 8833)
> Request:  <socket._socketobject object at 0x1087bc8>
> Traceback (most recent call last):
>   File 
> "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/SocketServer.
> py", line 281, in _handle_request_noblock
>     self.process_request(request, client_address)
>   File 
> "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/SocketServer.
> py", line 307, in process_request
>     self.finish_request(request, client_address)
>   File 
> "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/SocketServer.
> py", line 320, in finish_request
>     self.RequestHandlerClass(request, client_address, self)
>   File 
> "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/idlelib/rpc.p
> y", line 503, in __init__
>     SocketServer.BaseRequestHandler.__init__(self, sock, addr, svr)
>   File 
> "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/SocketServer.
> py", line 615, in __init__
>     self.handle()
>   File 
> "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/idlelib/run.p
> y", line 256, in handle
>     import IOBinding
>   File 
> "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/idlelib/IOBin
> ding.py", line 12, in <module>
>     import tempfile
>   File 
> "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/tempfile.py",
>  line 34, in <module>
>     from random import Random as _Random
>   File "random.py", line 3, in <module>
>     import rand      # handy random-number functions
> ImportError: No module named rand
> 
> *** Unrecoverable, server exiting!
[...]

It looks like you have a file named random.py in your Documents 
directory.  IDLE.app adds ~/Documents to the front of sys.path, python's 
search path for modules.   Your random.py is being found before the 
standard library module, random, causing the idle server process to 
abort.  Rename your random.py* and all should be well for both 2.5 and 
2.6.

One could argue that IDLE.app should be smarter about situations like 
this.  It would be good to open an issue about this on the python 
tracker:
   http://bugs.python.org/

--
  Ned Deily
  nad at acm.org -- []

-- 
 Ned Deily,
 nad at acm.org




More information about the Python-list mailing list