Skip to content

Flask server address error #7

@kcpevey

Description

@kcpevey

If I have a notebook that is attempting to run/authenticate uit, and I open up a second notebook, I will get the following error. Might want to consider randomizing the flask server address to avoid this error:

---------------------------------------------------------------------------
OSError                                   Traceback (most recent call last)
<ipython-input-3-b1a9d2b782d4> in <module>
----> 1 c.authenticate(notebook=True)

~/miniconda3/envs/adhui0715/lib/python3.6/site-packages/uit/uit.py in authenticate(self, notebook, width, height, callback)
    199 
    200         # start flask server
--> 201         start_server(self.get_token, self.config_file)
    202 
    203         auth_url = self.get_auth_url()

~/miniconda3/envs/adhui0715/lib/python3.6/site-packages/uit/uit.py in start_server(auth_func, config_file)
    619 def start_server(auth_func, config_file):
    620     app = Flask('get_uit_token')
--> 621     server = ServerThread(app)
    622     server.start()
    623 

~/miniconda3/envs/adhui0715/lib/python3.6/site-packages/uit/uit.py in __init__(self, app)
    606     def __init__(self, app):
    607         threading.Thread.__init__(self)
--> 608         self.srv = make_server('127.0.0.1', 5000, app)
    609         self.ctx = app.app_context()
    610         self.ctx.push()

~/miniconda3/envs/adhui0715/lib/python3.6/site-packages/werkzeug/serving.py in make_server(host, port, app, threaded, processes, request_handler, passthrough_errors, ssl_context, fd)
    818     else:
    819         return BaseWSGIServer(
--> 820             host, port, app, request_handler, passthrough_errors, ssl_context, fd=fd
    821         )
    822 

~/miniconda3/envs/adhui0715/lib/python3.6/site-packages/werkzeug/serving.py in __init__(self, host, port, app, handler, passthrough_errors, ssl_context, fd)
    696         if self.address_family == af_unix and os.path.exists(server_address):
    697             os.unlink(server_address)
--> 698         HTTPServer.__init__(self, server_address, handler)
    699 
    700         self.app = app

~/miniconda3/envs/adhui0715/lib/python3.6/socketserver.py in __init__(self, server_address, RequestHandlerClass, bind_and_activate)
    451         if bind_and_activate:
    452             try:
--> 453                 self.server_bind()
    454                 self.server_activate()
    455             except:

~/miniconda3/envs/adhui0715/lib/python3.6/http/server.py in server_bind(self)
    134     def server_bind(self):
    135         """Override server_bind to store the server name."""
--> 136         socketserver.TCPServer.server_bind(self)
    137         host, port = self.server_address[:2]
    138         self.server_name = socket.getfqdn(host)

~/miniconda3/envs/adhui0715/lib/python3.6/socketserver.py in server_bind(self)
    465         if self.allow_reuse_address:
    466             self.socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
--> 467         self.socket.bind(self.server_address)
    468         self.server_address = self.socket.getsockname()
    469 

OSError: [Errno 48] Address already in use

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions