Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IDLE Hung up after open script by command line... #43998

Closed
faramir2 mannequin opened this issue Sep 20, 2006 · 5 comments
Closed

IDLE Hung up after open script by command line... #43998

faramir2 mannequin opened this issue Sep 20, 2006 · 5 comments
Assignees

Comments

@faramir2
Copy link
Mannequin

faramir2 mannequin commented Sep 20, 2006

BPO 1562193
Nosy @kbkaiser, @taleinat
Files
  • prx.py: Script from bug report
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = 'https://github.com/kbkaiser'
    closed_at = <Date 2007-02-06.03:23:32.000>
    created_at = <Date 2006-09-20.13:10:34.000>
    labels = ['expert-IDLE', 'invalid']
    title = 'IDLE Hung up after open script by command line...'
    updated_at = <Date 2007-02-06.03:23:32.000>
    user = 'https://bugs.python.org/faramir2'

    bugs.python.org fields:

    activity = <Date 2007-02-06.03:23:32.000>
    actor = 'kbk'
    assignee = 'kbk'
    closed = True
    closed_date = None
    closer = None
    components = ['IDLE']
    creation = <Date 2006-09-20.13:10:34.000>
    creator = 'faramir2'
    dependencies = []
    files = ['2147']
    hgrepos = []
    issue_num = 1562193
    keywords = []
    message_count = 5.0
    messages = ['29886', '29887', '29888', '29889', '29890']
    nosy_count = 3.0
    nosy_names = ['kbk', 'taleinat', 'faramir2']
    pr_nums = []
    priority = 'normal'
    resolution = 'not a bug'
    stage = None
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue1562193'
    versions = ['Python 2.5']

    @faramir2
    Copy link
    Mannequin Author

    faramir2 mannequin commented Sep 20, 2006

    Hello,

    I wrote that code in python and saved as prx.py:
    --- CUT ---

    from BaseHTTPServer import HTTPServer, 
    BaseHTTPRequestHandler
    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.path,  
    self.request_version, self.headers)
             header={}
             header["content-length"]=0
             for i in str(self.headers).split("\r\n"):
                 j=i.split(":", 1)
                 if len(j)==2:
                     header[j[0].strip().lower()] = 
    j[1].strip()
             content=self.rfile.read(int(header["content-
    length"]))
             print content
             url="http://faramir2.prv.pl"
             u=urllib2.urlopen(url)
             for i,j in u.info().items():
                 print "%s: %s" % (i,j)
             self.server_version = "Apache"
             self.sys_version = ""
             self.send_response(200)
             self.send_header("Content-type", "text/html; 
    charset=ISO-8859-2")
             self.send_header("Connectin", "close")
             self.end_headers()
         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

    ---
    Again:

    • 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://
    localhost:80
    // IDLE freezes

    • Works ok:

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

    regards,
    Marek

    @faramir2 faramir2 mannequin closed this as completed Sep 20, 2006
    @faramir2 faramir2 mannequin added the invalid label Sep 20, 2006
    @faramir2 faramir2 mannequin assigned kbkaiser Sep 20, 2006
    @faramir2 faramir2 mannequin added the topic-IDLE label Sep 20, 2006
    @faramir2 faramir2 mannequin closed this as completed Sep 20, 2006
    @faramir2 faramir2 mannequin added the invalid label Sep 20, 2006
    @faramir2 faramir2 mannequin assigned kbkaiser Sep 20, 2006
    @faramir2 faramir2 mannequin added the topic-IDLE label Sep 20, 2006
    @taleinat
    Copy link
    Contributor

    taleinat commented Dec 9, 2006

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

    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 them.

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

    @kbkaiser
    Copy link
    Contributor

    kbkaiser commented Feb 5, 2007

    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.

    @faramir2
    Copy link
    Mannequin Author

    faramir2 mannequin commented Feb 5, 2007

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

    @kbkaiser
    Copy link
    Contributor

    kbkaiser commented Feb 6, 2007

    OK, thanks.

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants