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

/usr/bin/python: No module named SimpleHTTPServer #1

Closed
hbons opened this issue Aug 28, 2011 · 15 comments
Closed

/usr/bin/python: No module named SimpleHTTPServer #1

hbons opened this issue Aug 28, 2011 · 15 comments

Comments

@hbons
Copy link

hbons commented Aug 28, 2011

[hbons@myhost magicmockup]$ ./webserver.sh
Visit http://localhost:8000/demo.svg
/usr/bin/python: No module named SimpleHTTPServer

which deps do i need? :(

@garrett
Copy link
Owner

garrett commented Aug 28, 2011

You need Python installed. I thought SimpleHTTPServer shipped with Python.

You don't actually need it for MagicMockup, however... any webserver will do. This is just to start something that should work wherever Python is installed. (It works on my Mac and on Linux w/o a problem.)

Did you compile Python yourself (without proper deps) or something? (:

@hbons
Copy link
Author

hbons commented Aug 28, 2011

I moved to Arch Linux, that's probably it... Never mind this. Could we use NodeJS or something instead? That also seems like more in the spirit of the project :)

@garrett
Copy link
Owner

garrett commented Aug 29, 2011

Okay, I added support for http-server, from npm. It's basically the node equivalent. I even made both it and Python's server default to port 8000 for consistency.

  npm install http-server

I also wrote up how to use it, etc., but github failed to save my edit with a stupid error, and the text I wrote in the README is gone forever, sadly.

(It now defaults to using http-server, and then tries Python if that doesn't work.)

@gonru
Copy link

gonru commented Jan 28, 2014

Try with python3 -m http.server 8000.

@oswaldojr
Copy link

Working! Thanks garaPM

@ilovechai
Copy link

ilovechai commented Feb 22, 2018

If it still does not work write the following code and it should work

import SimpleHTTPServer
import SocketServer
PORT = 8000
Handler = SimpleHTTPServer.SimpleHTTPRequestHandler
httpd = SocketServer.TCPServer(("", PORT), Handler)
print "serving at port", PORT
httpd.serve_forever()

@donbright
Copy link

yeah this is some mid 2010s stuff, doesnt work in these modern, tough times.

@niranjanreddy891
Copy link

niranjanreddy891 commented Sep 6, 2018

Use python -m http.server. It works for me. :)
By default the port is 8000. No need to specify. If we want to run any other local host we can specify the port number at the end

@aruntirath
Copy link

aruntirath commented Mar 22, 2019

I think you are using python3. For python3 instead of python -m SimpleHTTPServer you should use
python3 -m http.server or python -m http.server

@ghost
Copy link

ghost commented Jun 3, 2020

@aruntirath thx man, it's work.

@garrett
Copy link
Owner

garrett commented Jun 4, 2020

I've updated the script for Python 3.

be4e913

We last worked on this repo around 9 years ago. I guess it's still working (aside from the Python version issue)?

@garrett garrett closed this as completed Jun 4, 2020
@garrett
Copy link
Owner

garrett commented Jun 4, 2020

I've updated the CoffeeScript to work with CoffeeScript 2 and recompiled the JS. Additionally, I've (slightly) modified the README to drop the Ruby reference and go with just NPM for installing CoffeeScript.

It's a start.

It's at #17 — I might get the chance to update things coming soon, but if anyone else could test out the branch and provide feedback, that would be appreciated. Perhaps we can modernize things. 😉

@savetheword
Copy link

Try with python3 -m http.server 8000.

Thanks!

@Bnke0x0
Copy link

Bnke0x0 commented Aug 20, 2022

use python3 -m http.server 80 or python -m http.serve 8080

@HackerInfo2024
Copy link

@garaPM surprised to find this 9 years later and worked. Exactly what I was looking for.Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests