Skip to content

Commit

Permalink
server: show detailed message if cannot listen port
Browse files Browse the repository at this point in the history
  • Loading branch information
tankywoo committed May 30, 2016
1 parent e6d4ea9 commit 63888fa
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion simiki/server.py
Expand Up @@ -6,6 +6,7 @@
import os.path
import sys
import logging
import traceback

try:
import SimpleHTTPServer as http_server
Expand Down Expand Up @@ -86,7 +87,8 @@ def preview(path, url_root, host='localhost', port=8000):
Handler = YARequestHandler
httpd = Reuse_TCPServer((host, port), Handler)
except (OSError, IOError) as e:
logging.error("Could not listen on port {0}".format(port))
logging.error("Could not listen on port {0}\n{1}"
.format(port, traceback.format_exc()))
sys.exit(getattr(e, 'exitcode', 1))

logging.info("Serving at: http://{0}:{1}{2}/".format(host, port, url_root))
Expand Down

0 comments on commit 63888fa

Please sign in to comment.