##// END OF EJS Templates
entry from command line to notebook
Zachary Sailer -
Show More
@@ -298,6 +298,7 b' class NotebookApp(BaseIPythonApplication):'
298
298
299 # file to be opened in the notebook server
299 # file to be opened in the notebook server
300 file_to_run = Unicode('')
300 file_to_run = Unicode('')
301 entry_path = Unicode('')
301
302
302 # Network related information.
303 # Network related information.
303
304
@@ -505,11 +506,13 b' class NotebookApp(BaseIPythonApplication):'
505 if self.extra_args:
506 if self.extra_args:
506 f = os.path.abspath(self.extra_args[0])
507 f = os.path.abspath(self.extra_args[0])
507 if os.path.isdir(f):
508 if os.path.isdir(f):
508 nbdir = f
509 self.entry_path = self.extra_args[0]
509 else:
510 elif os.path.isfile(f):
510 self.file_to_run = f
511 self.file_to_run = f
511 nbdir = os.path.dirname(f)
512 path = os.path.split(self.extra_args[0])
512 self.config.NotebookManager.notebook_dir = nbdir
513 if path[0] != '':
514 self.entry_path = path[0]+'/'
515
513
516
514 def init_kernel_argv(self):
517 def init_kernel_argv(self):
515 """construct the kernel arguments"""
518 """construct the kernel arguments"""
@@ -737,9 +740,9 b' class NotebookApp(BaseIPythonApplication):'
737
740
738 if self.file_to_run:
741 if self.file_to_run:
739 name, _ = os.path.splitext(os.path.basename(self.file_to_run))
742 name, _ = os.path.splitext(os.path.basename(self.file_to_run))
740 url = self.notebook_manager.rev_mapping.get(name, '')
743 url = 'notebooks/' + self.entry_path + name + _
741 else:
744 else:
742 url = ''
745 url = 'tree/' + self.entry_path
743 if browser:
746 if browser:
744 b = lambda : browser.open("%s://%s:%i%s%s" % (proto, ip,
747 b = lambda : browser.open("%s://%s:%i%s%s" % (proto, ip,
745 self.port, self.base_project_url, url), new=2)
748 self.port, self.base_project_url, url), new=2)
General Comments 0
You need to be logged in to leave comments. Login now