Skip to content

Commit

Permalink
Use notebook_dir or file_to_run automatically
Browse files Browse the repository at this point in the history
  • Loading branch information
remram44 committed Apr 16, 2015
1 parent c52790f commit a65c7b3
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions nbopen.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,14 @@ def nbopen(filename, profile='default'):
webbrowser.open(url, new=2)
elif filename.startswith(home_dir):
print("Starting new server")
notebookapp.launch_new_instance(file_to_run=os.path.abspath(filename),
notebook_dir=home_dir,
open_browser=True,
filename = os.path.abspath(filename)
if os.path.isdir(filename):
kw = {'notebook_dir': filename}
else:
kw = {'file_to_run': filename}
notebookapp.launch_new_instance(open_browser=True,
argv=[], # Avoid it seeing our own argv
**kw,
)
else:
raise OutsideHomeDir
Expand Down

0 comments on commit a65c7b3

Please sign in to comment.