Python Forum

Full Version: http.server start delay
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I'm trying to use python http.server with the following command:

python -m http.server 8000
but I'm consistently waiting 30 seconds for it to start up.
I'm working on a MBP 15" 2017, MacOS X High Sierra 10.13.4.

I tried closing all applications, restarting the computer, resetting PRAM and SMC; tried upgrading to python 3.7 (from 3.6.4) [via homebrew] and it didn't help; I tried using python3 -m http.server, and finally uninstalled python 3 and tried python 2.7's

python -m SimpleHTTPServer
but again I got the same result.
Each try was timed using time python -m http.server and pressing ^C after starting. The ^C remained in the buffer until the server started.

Each time the output was something along the lines of
real 0m30.089s user 0m0.040s sys 0m0.035s
with user and sys going up to around 80-100ms and real to 30.120ms!
My other Express.js apps launch immediately on localhost.

I'm guessing there's a 30 seconds timeout or delay somewhere that gets triggered, but I don't know why and how to solve it! I really don't even know where to look.

(It's my first post here, I'm not sure if it's the right section!)
Hm, that's very odd. I just tried it but couldn't replicate your findings. Have you tried a different port?