takluyver / nbopen

Open a Jupyter notebook in the best available server
BSD 3-Clause "New" or "Revised" License
304 stars 58 forks source link

500 : Internal Server Error #32

Open BenjaminKay opened 8 years ago

BenjaminKay commented 8 years ago

I have installed nbopen on a Windows 10 machine and then double clicked on a ipynb file. a new tab opens up in a browser and it has the Jupyter logo in the upper left but the notebook doesn't actually open. All I get is "500 : Internal Server Error" where the notebook should be. nbopen tries to open the url: http://localhost:8888/notebooks/Hello%20World.ipynb The correct url is : http://localhost:8888/notebooks/local/Hello%20World.ipynb

I'm pretty sure that this is because I use the Jupyter Drive extension for Jupyter, particularly in "mixed" mode. This makes the URL a bit different. However, I have no idea how to customize or change the URL, so I'm not sure how to handle this. Any ideas?

takluyver commented 8 years ago

Yep, nbopen isn't aware of Jupyter Drive, or non-default content managers in general, and it doesn't currently have any way to configure it. If it's opening with an existing server, here's the line that constructs the URL:

https://github.com/takluyver/nbopen/blob/63fa91b69addb3972b1108810c0f8b2f12dc48bd/nbopen.py#L38

Feel free to edit that locally for your own use.

For a proper fix, I'm reluctant to try to detect this kind of thing automatically, as that sounds complex and error prone. So I guess that means it would need some kind of simple config, like maybe an environment variable.

BenjaminKay commented 8 years ago

This advice worked for me. Here is the change I made. Instead of:

url = url_path_join(server_inf['url'], 'notebooks', url_escape(path))

I changed line 38 to

url = url_path_join(server_inf['url'], 'notebooks/local/', url_escape(path))

Then I reran python win-install.py and it worked.