7 from bottle import thread # portable import
9 import m_librarian.web.app # noqa: F401 imported but unused
10 from m_librarian.web.server import run_server
11 from m_librarian.web.utils import get_open_port
14 def start_browser(port):
15 time.sleep(1) # A small timeout to allow the main thread to run the server
16 webbrowser.open_new('http://localhost:%d/' % port)
19 if __name__ == '__main__':
20 parser = argparse.ArgumentParser(description='Init')
21 parser.add_argument('-p', '--port', help='HTTP server port')
22 args = parser.parse_args()
27 port = get_open_port()
29 thread.start_new_thread(start_browser, (port,))