I want to set up Python SimpleHTTPServer on Windows XP. I have Python installed on my computer. I am executing the following command:
python -m SimpleHTTPServer 8888
But I am getting the error:
C:Python33python.exe: No module named SimpleHTTPServer
Is SimpleHTTPServer for Python available on Windows? If yes, what do I do to set up the server?
Answers:
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
Method 1
From Stack Overflow question What is the Python 3 equivalent of “python -m SimpleHTTPServer”:
SimpleHTTPServer is for python2, so you’re getting the error.
In python3, The following works:
python -m http.server [<portNo>]
Because using Python 3, the module SimpleHTTPServer has been replaced by http.server, at least in Windows.
All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0