<div>Hi all, another WinXP SP2 user here.</div>
<div> </div>
<div>First of all, this should be reproducible on any platform by running IDLE with the "-n" flag.</div>
<div> </div>
<div>On windows, the Python installer adds a "Edit with IDLE" context menu entry. The OP mentioned that the problem only occurred when he opened the file in this method and ran it with F5. Currently, the "Edit with IDLE" option opens IDLE
<strong>without</strong> a subprocess (with the "-n" flag), while the IDLE shortcut runs IDLE <strong>with</strong> a subprocess (without the "-n" flag). In general it is much better to run IDLE with a subprocess.
</div>
<div> </div>
<div>In this case what's happening is that the Python interpreter is constantly busy, and (almost) never gets around to running IDLE. This is because IDLE and the shell are actually running in the same process. On the other hand, having IDLE and the shell run in separate processes allows IDLE to continue functioning even while the shell is blocking or busy.
</div>
<div> </div>
<div>IDLE isn't broken, on the contrary! In IDLE the shell can be separated from the GUI, which is a great feature, not found in most other Python interpreters.</div>
<div> </div>
<div>- Tal<br> </div>
<div>P.S. The reason "Edit with IDLE" opens IDLE without a subprocess is that in the current version there can only be one instance of IDLE with a subprocess. I have submitted a patch to workaround this, and which allows multiple version of IDLE to run in parallel, each with a subprocess of its own. The patch must be more thoroughly tested and tweaked, but IMO is worth giving a try.
</div>
<div><br> </div>
<div><span class="gmail_quote">On 9/19/06, <b class="gmail_sendername">Marek Nowicki</b> <<a href="mailto:faramir2@gazeta.pl">faramir2@gazeta.pl</a>> wrote:</span>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">Hello,<br><br>I wrote that code in python and saved as prx.py:<br>--- CUT ---<br>from BaseHTTPServer import HTTPServer, BaseHTTPRequestHandler
<br>from time import strftime, gmtime<br>import urllib2<br>import thread<br>from sys import stdout<br>class RequestHandler(BaseHTTPRequestHandler):<br> def serve(self):<br> print "%s %s %s\r\n%s" % (self.command
, self.path,<br>self.request_version, self.headers)<br> header={}<br> header["content-length"]=0<br> for i in str(self.headers).split("\r\n"):<br> j=i.split(":", 1)
<br> if len(j)==2:<br> header[j[0].strip().lower()] = j[1].strip()<br> content=self.rfile.read(int(header["content-length"]))<br> print content<br> url="<a href="http://faramir2.prv.pl">
http://faramir2.prv.pl</a>"<br> u=urllib2.urlopen(url)<br> for i,j in u.info().items():<br> print "%s: %s" % (i,j)<br> self.server_version = "Apache"<br> self.sys_version
= ""<br> self.send_response(200)<br> self.send_header("Content-type", "text/html; charset=ISO-8859-2")<br> self.send_header("Connectin", "close")<br>
self.end_headers()<br> def do_POST(self): self.serve()<br> def do_HEAD(self): self.serve()<br> def do_GET(self): self.serve()<br># from sys import exit<br># exit(1)<br>address = ("", 80)<br>server = HTTPServer(address, RequestHandler)
<br>thread.start_new_thread(server.serve_forever, () )<br>--- CUT ---<br><br>When I right click on that file and select "Edit with IDLE" it opens. Then<br>when I push F5 the script is running. *Python Shell* is restarting. But
<br>when I try to connect by browser to <a href="http://localhost:80/">http://localhost:80/</a> IDLE Hung-up. I<br>don't see that hung ups when I open IDLE from shortcut and then in IDLE<br>open file prx.py and run it works normally - good. IDLE does't hung up.
<br><br>I don't know why it works like that, but I think that it's bug..<br><br>Python version: 2.5c2<br>Tk version: 8.4<br>IDLE version: 1.2c2<br><br>regards,<br>Marek<br><br><br>_______________________________________________
<br>IDLE-dev mailing list<br><a href="mailto:IDLE-dev@python.org">IDLE-dev@python.org</a><br><a href="http://mail.python.org/mailman/listinfo/idle-dev">http://mail.python.org/mailman/listinfo/idle-dev</a></blockquote></div>