[ python-Bugs-1562193 ] IDLE Hung up after open script by command line...

SourceForge.net noreply at sourceforge.net
Mon Feb 5 12:13:23 CET 2007

Bugs item #1562193, was opened at 2006-09-20 13:10
Message generated for change (Comment added) made by faramir2
You can respond by visiting: 

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: IDLE
Group: Python 2.5
>Status: Open
Resolution: Invalid
Priority: 5
Private: No
Submitted By: Marek Nowicki (faramir2)
Assigned to: Kurt B. Kaiser (kbk)
Summary: IDLE Hung up after open script by command line...

Initial Comment:

I wrote that code in python and saved as prx.py:
--- CUT ---
from BaseHTTPServer import HTTPServer, 
from time import strftime, gmtime
import urllib2
import thread
 from sys import stdout
class RequestHandler(BaseHTTPRequestHandler):
     def serve(self):
         print "%s %s %s\r\n%s" % (self.command, 
self.request_version, self.headers)
         for i in str(self.headers).split("\r\n"):
             j=i.split(":", 1)
             if len(j)==2:
                 header[j[0].strip().lower()] = 
         print content
         for i,j in u.info().items():
             print "%s: %s" % (i,j)
         self.server_version = "Apache"
         self.sys_version = ""
         self.send_header("Content-type", "text/html; 
         self.send_header("Connectin", "close")
     def do_POST(self): self.serve()
     def do_HEAD(self): self.serve()
     def do_GET(self): self.serve()
address = ("", 80)
server = HTTPServer(address, RequestHandler)
thread.start_new_thread(server.serve_forever, () )
--- CUT ---
When I right click on that file and select "Edit with 
IDLE" it opens. Then  
when I push F5 the script is running. *Python Shell* 
is restarting. But  
when I try to connect by browser to http://
localhost:80/ IDLE Hung-up. I  
don't see that hung ups when I open IDLE from shortcut 
and then in IDLE  
open file prx.py and run it works normally - good. 
IDLE does't hung up.
I don't know why it works like that, but I think that 
it's bug..
Python version: 2.5c2
Tk version: 8.4
IDLE version: 1.2c2
OS Version: Microsoft Windows XP Professional with SP2

* Freeze:
"C:\Python25\pythonw.exe" "C:\Python25\Lib\idlelib\idle.pyw"
 -n -e "prx.py"
// then F5 on IDLE
// when run open Browser and try to open page: http://
// IDLE freezes

* Works ok:
"C:\Python25\pythonw.exe" "C:\Python25\Lib\idlelib\idle.pyw"
// open prx.py in IDLE
// press F5 on IDLE
// run Browwser and try to open page: http://
// all works ok



>Comment By: Marek Nowicki (faramir2)
Date: 2007-02-05 11:13

Logged In: YES 
Originator: YES

Ok. You can close this now. Thanks for responses.


Comment By: Kurt B. Kaiser (kbk)
Date: 2007-02-05 06:18

Logged In: YES 
Originator: NO

Well, Tal Einat has more patience than I do, and it sounds like he
diagnosed your problem.  I'm setting this pending, it will close in a
couple of weeks if you don't respond with further comments.


Comment By: Tal Einat (taleinat)
Date: 2006-12-09 17:54

Logged In: YES 
Originator: NO

Well, the issue obviously only happens when IDLE is running without a

The code you pasted is unindtented so I'm not going to try it out...

My guess would be that your server is blocking in a way that it blocks all
threads. This is why, when it is run in the same process as IDLE's GUI,
IDLE hangs. However, when you run IDLE with a subprocess, it's the
subprocess which is blocked, so IDLE works normally. (this is what the
subprocess is there for :)

In any case, IDLE is behaving just fine here. This isn't a bug in IDLE.

This could be a bug with the thread module, or a bug in BaseHTTPServer, or
several other places. But it is most likely caused by some misunderstanding
on your part of blocking operations, threads, and the interaction between

You should have tried posting this on c.l.py before posting a bug on SF,
and I suggest you do so now.


You can respond by visiting: 

More information about the Python-bugs-list mailing list