def __call__(self, args): kwargs = {} try: # IPython 1.0+ from IPython.html.notebookapp import NotebookApp except ImportError: # pre-IPython v1.0 from IPython.frontend.html.notebook.notebookapp import NotebookApp print("You must choose a password so that others cannot connect to " \ "your notebook.") pw = ytcfg.get("yt", "notebook_password") if len(pw) == 0 and not args.no_password: import IPython.lib pw = IPython.lib.passwd() print("If you would like to use this password in the future,") print("place a line like this inside the [yt] section in your") print("yt configuration file at ~/.yt/config") print() print("notebook_password = %s" % pw) print() elif args.no_password: pw = None if args.port != 0: kwargs['port'] = int(args.port) if args.profile is not None: kwargs['profile'] = args.profile if pw is not None: kwargs['password'] = pw app = NotebookApp(open_browser=args.open_browser, **kwargs) app.initialize(argv=[]) print() print( "***************************************************************") print() print("The notebook is now live at:") print() print(" http://127.0.0.1:%s/" % app.port) print() print("Recall you can create a new SSH tunnel dynamically by pressing") print("~C and then typing -L%s:localhost:%s" % (app.port, app.port)) print("where the first number is the port on your local machine. ") print() print("If you are using %s on your machine already, try " \ "-L8889:localhost:%s" % (app.port, app.port)) print() print( "***************************************************************") print() app.start()
def __call__(self, args): kwargs = {} try: # IPython 1.0+ from IPython.html.notebookapp import NotebookApp except ImportError: # pre-IPython v1.0 from IPython.frontend.html.notebook.notebookapp import NotebookApp print("You must choose a password so that others cannot connect to " \ "your notebook.") pw = ytcfg.get("yt", "notebook_password") if len(pw) == 0 and not args.no_password: import IPython.lib pw = IPython.lib.passwd() print("If you would like to use this password in the future,") print("place a line like this inside the [yt] section in your") print("yt configuration file at ~/.yt/config") print() print("notebook_password = %s" % pw) print() elif args.no_password: pw = None if args.port != 0: kwargs['port'] = int(args.port) if args.profile is not None: kwargs['profile'] = args.profile if pw is not None: kwargs['password'] = pw app = NotebookApp(open_browser=args.open_browser, **kwargs) app.initialize(argv=[]) print() print("***************************************************************") print() print("The notebook is now live at:") print() print(" http://127.0.0.1:%s/" % app.port) print() print("Recall you can create a new SSH tunnel dynamically by pressing") print("~C and then typing -L%s:localhost:%s" % (app.port, app.port)) print("where the first number is the port on your local machine. ") print() print("If you are using %s on your machine already, try " \ "-L8889:localhost:%s" % (app.port, app.port)) print() print("***************************************************************") print() app.start()