SimpleHTTPServer problems when tying up main thread

David Fisher python at rose164.wuh.wustl.edu
Wed Mar 29 18:17:00 EST 2000


What's your OS?  You might try to use threading instead of thread.  It fixes
a problem on solaris.
dnf

----- Original Message -----
From: <t_e_sanders at my-deja.com>
Newsgroups: comp.lang.python
To: <python-list at python.org>
Sent: Wednesday, March 29, 2000 2:39 PM
Subject: SimpleHTTPServer problems when tying up main thread


> Howdy. I'm experiencing problems when I try to use
> SimpleHTTPServer while tying up the main thread;
> specifically, I'm calling code roughly as follows:
>
> > # Start the server up:
> > server=SimpleHTTPServer.HTTPServer((address, >
> port), webserver)
> > thread.start_new_thread(server.serve_forever,
> ())
> >
> > # Do something forever:
> > while 1:
> >         time.sleep(1.0)
> >         unrelated_stuff()
>
> It seems that if I let the main thread run out
> such that I get the ">>>" prompt, the server acts
> normally; however, when I prevent the main thread
> from completing the script, the page is never
> served. BasicHTTPServer.handle_request() seems to
> complete, but it the page never gets out;
> SimmpleHTTPServer's log_request never gets
> called.
>
> I must be missing something thread-related, but I
> can't seem to track it down; can anyone offer any
> advice?
>
> Thanks much,
> Thomas Sanders
> t.e.sanders at usa.net
>
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
> --
> http://www.python.org/mailman/listinfo/python-list





More information about the Python-list mailing list