SimpleHTTPServer problems when tying up main thread

t_e_sanders at t_e_sanders at
Wed Mar 29 22:39:29 CEST 2000

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

I must be missing something thread-related, but I
can't seem to track it down; can anyone offer any

Thanks much,
Thomas Sanders
t.e.sanders at

Sent via
Before you buy.

More information about the Python-list mailing list