nbdime icon indicating copy to clipboard operation
nbdime copied to clipboard

nbdime doesn't like windows network drives

Open scdevries opened this issue 5 years ago • 6 comments

I'm using the Jupyterlab-git extension, which uses nbdime for diffing. When I'm working in a folder on a network drive (Windows) this leads to an error in Jupyter lab

Failed to fetch diff with error:Unexpected token H in JSON at position 0

On the command prompt that executed Jupyter lab I can see that this is probably caused by the file path. Part of the error message looks like:

[W 14:36:28.904 LabApp] 422 POST /nbdime/api/gitdiff?1589200588806 (::1): Invalid notebook: h:\SERVERNAME\FILESYSTEMROOT\one directory\other directory\my tests.ipynb

The path mentioned in the message looks like a mixture of the two ways I can address this folder. H: is the drive letter to which the UNC path \SERVERNAME\FILESYSTEMROOT\ is mapped. (notice that the double backslash of the UNC path is missing in the error message) So, the file path should be either:

h:\one directory\other directory\my tests.ipynb

or

\\SERVERNAME\FILESYSTEMROOT\one directory\other directory\my tests.ipynb

Is there a way to teach nbdime to use the correct path, or let it use the relative path ("."in this case) as I already cd-ed into this folder? Perhaps the path should also be double quoted as there are spaces in the directory and file names.

To be sure: when I copy this folder to C: everything works A-OK. So, it really looks like this is a path issue and not something else related to the repository. I also installed everything fresh today, so it is also not a question of a legacy version or so. Jupyter-Git itself is working quite well too.

scdevries avatar May 11 '20 12:05 scdevries

This might be an issue with how jupyterlab-git is using the nbdime REST API. Could you open up the developer tools in the browser, go to the network tab, use jupyterlab-git to ask for the diff that breaks, and then see in the network tab any entries hitting /nbdime/api/gitdiff ? If you can find it, and share the details of the request, that would be very helpful in troubleshooting this.

vidartf avatar May 12 '20 13:05 vidartf

Slightly anonymized, the request block is below. I think the crucial part (the file path) is at the bottom. Note that my current directory is 2. Code library.

Invoke-WebRequest -Uri "http://localhost:8888/nbdime/api/gitdiff?1589304998232" -Method "POST" -Headers @{ "User-Agent"="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.122 Safari/537.36" "X-XSRFToken"="2|9b634a47|etcetcetc" "Authorization"="token eteeteetc" "Accept"="/" "Origin"="http://localhost:8888" "Sec-Fetch-Site"="same-origin" "Sec-Fetch-Mode"="cors" "Sec-Fetch-Dest"="empty" "Referer"="http://localhost:8888/lab" "Accept-Encoding"="gzip, deflate, br" "Accept-Language"="en-GB,en-US;q=0.9,en;q=0.8" "Cookie"="_xsrf=2|9b634a47|etcetcetc; username-localhost-8889="2|1:0|10:1589272611|23:username-localhost-8889|etc"" } -ContentType "application/json" -Body "{"file_path":"../../../XXXXX.CORP/FS/RM/RMVM/1. Val/IF9/12 IF9 Framework/2020/2. Code library/3. Model Output - Accuracy.ipynb","ref_local":{"git":"c31766db6aab37cee15c36c5d77c54a3748187eb"},"ref_remote":{"git":"db34480c53bf45a38845f14643e873beeb76ddd1"}}"

The response is also useful information:

HTTP 422: Unprocessable Entity (Invalid notebook: H:\ XXXXX.CORP\FS\RM\RMVM\1. Val\IF9\12 IF9 Framework\2020\2. Code library\3. Model Output - Accuracy.ipynb)

Note that the correct windows path should be (as I mentioned in my original message) either: "H:\RMVM\1. Val\IF9\12 IF9 Framework\2020\2. Code library \3. Model Output - Accuracy.ipynb" or \XXXXX.corp\FS\RM\RMVM\1\1. Val\IF9\12 IF9 Framework\2020\2. Code library \3. Model Output - Accuracy.ipynb

scdevries avatar May 12 '20 19:05 scdevries

Thanks. I'd try to cross-post this to the jupyterlab-git repo as well (referencing this issue there and vice-versa). Note that nbdime assumes the path is given is relative to the root of the contents manager (could you please verify that you are using the latest version of nbdime so we can assume this to be the case?).

vidartf avatar May 13 '20 12:05 vidartf

Thanks. I'd try to cross-post this to the jupyterlab-git repo as well (referencing this issue there and vice-versa). Note that nbdime assumes the path is given is relative to the root of the contents manager (could you please verify that you are using the latest version of nbdime so we can assume this to be the case?).

The version that I have installed is 2.0.0

scdevries avatar May 14 '20 20:05 scdevries

Thanks. I'd try to cross-post this to the jupyterlab-git repo as well (referencing this issue there and vice-versa). Note that nbdime assumes the path is given is relative to the root of the contents manager (could you please verify that you are using the latest version of nbdime so we can assume this to be the case?).

Do you happen to have the issue number for the issue that you cross posted? I have difficulties finding it.

scdevries avatar Aug 19 '20 12:08 scdevries

Oh I'm sorry, I meant that I would recommend for you to do it. Sorry if the language was a little unclear.

vidartf avatar Aug 20 '20 10:08 vidartf