tarmstrong / nbdiff

A diffing and merging tool for the IPython Notebook.
http://nbdiff.org
MIT License
212 stars 28 forks source link

Try another port if the first one is in use #238

Open jakirkham opened 9 years ago

jakirkham commented 9 years ago

Port 5000 is a common one to use. There should be a more graceful fallback than just crashing (e.g. bump the port number and try again).

Traceback (most recent call last):
  File "/zopt/conda/envs/nanshenv/bin/nbdiff", line 6, in <module>
    sys.exit(diff())
  File "/zopt/conda/envs/nanshenv/lib/python2.7/site-packages/nbdiff/commands.py", line 87, in diff
    app.run(debug=args.debug)
  File "/zopt/conda/envs/nanshenv/lib/python2.7/site-packages/flask/app.py", line 772, in run
    run_simple(host, port, self, **options)
  File "/zopt/conda/envs/nanshenv/lib/python2.7/site-packages/werkzeug/serving.py", line 625, in run_simple
    inner()
  File "/zopt/conda/envs/nanshenv/lib/python2.7/site-packages/werkzeug/serving.py", line 603, in inner
    passthrough_errors, ssl_context).serve_forever()
  File "/zopt/conda/envs/nanshenv/lib/python2.7/site-packages/werkzeug/serving.py", line 512, in make_server
    passthrough_errors, ssl_context)
  File "/zopt/conda/envs/nanshenv/lib/python2.7/site-packages/werkzeug/serving.py", line 440, in __init__
    HTTPServer.__init__(self, (host, int(port)), handler)
  File "/zopt/conda/envs/nanshenv/lib/python2.7/SocketServer.py", line 420, in __init__
    self.server_bind()
  File "/zopt/conda/envs/nanshenv/lib/python2.7/BaseHTTPServer.py", line 108, in server_bind
    SocketServer.TCPServer.server_bind(self)
  File "/zopt/conda/envs/nanshenv/lib/python2.7/SocketServer.py", line 434, in server_bind
    self.socket.bind(self.server_address)
  File "/zopt/conda/envs/nanshenv/lib/python2.7/socket.py", line 228, in meth
    return getattr(self._sock,name)(*args)
socket.error: [Errno 48] Address already in use