Show More
@@ -295,7 +295,6 b' class NotebookApp(BaseIPythonApplication):' | |||||
295 |
|
295 | |||
296 | # file to be opened in the notebook server |
|
296 | # file to be opened in the notebook server | |
297 | file_to_run = Unicode('') |
|
297 | file_to_run = Unicode('') | |
298 | entry_path = Unicode('') |
|
|||
299 |
|
298 | |||
300 | # Network related information. |
|
299 | # Network related information. | |
301 |
|
300 | |||
@@ -502,14 +501,13 b' class NotebookApp(BaseIPythonApplication):' | |||||
502 |
|
501 | |||
503 | if self.extra_args: |
|
502 | if self.extra_args: | |
504 | f = os.path.abspath(self.extra_args[0]) |
|
503 | f = os.path.abspath(self.extra_args[0]) | |
|
504 | if not os.path.exists(f): | |||
|
505 | self.log.critical("No such file or directory: %s", f) | |||
|
506 | self.exit(1) | |||
505 | if os.path.isdir(f): |
|
507 | if os.path.isdir(f): | |
506 | self.entry_path = self.extra_args[0] |
|
508 | self.config.FileNotebookManager.notebook_dir = f | |
507 | elif os.path.isfile(f): |
|
509 | elif os.path.isfile(f): | |
508 | self.file_to_run = f |
|
510 | self.file_to_run = f | |
509 | path = os.path.split(self.extra_args[0]) |
|
|||
510 | if path[0] != '': |
|
|||
511 | self.entry_path = path[0]+'/' |
|
|||
512 |
|
||||
513 |
|
511 | |||
514 | def init_kernel_argv(self): |
|
512 | def init_kernel_argv(self): | |
515 | """construct the kernel arguments""" |
|
513 | """construct the kernel arguments""" | |
@@ -735,11 +733,19 b' class NotebookApp(BaseIPythonApplication):' | |||||
735 | except webbrowser.Error as e: |
|
733 | except webbrowser.Error as e: | |
736 | self.log.warn('No web browser found: %s.' % e) |
|
734 | self.log.warn('No web browser found: %s.' % e) | |
737 | browser = None |
|
735 | browser = None | |
|
736 | ||||
|
737 | nbdir = os.path.abspath(self.notebook_manager.notebook_dir) | |||
|
738 | f = self.file_to_run | |||
|
739 | if f.startswith(nbdir): | |||
|
740 | f = f[len(nbdir):] | |||
|
741 | else: | |||
|
742 | self.log.warn("Probably won't be able to open notebook %s", f) | |||
|
743 | self.log.warn("Because it is not in notebook_dir %s", nbdir) | |||
738 |
|
744 | |||
739 | if self.file_to_run: |
|
745 | if os.path.isfile(self.file_to_run): | |
740 |
url = url_path_join('notebooks', |
|
746 | url = url_path_join('notebooks', f) | |
741 | else: |
|
747 | else: | |
742 |
url = url_path_join('tree', |
|
748 | url = url_path_join('tree', f) | |
743 | if browser: |
|
749 | if browser: | |
744 | b = lambda : browser.open("%s://%s:%i%s%s" % (proto, ip, |
|
750 | b = lambda : browser.open("%s://%s:%i%s%s" % (proto, ip, | |
745 | self.port, self.base_project_url, url), new=2) |
|
751 | self.port, self.base_project_url, url), new=2) |
General Comments 0
You need to be logged in to leave comments.
Login now