New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Path issue for diffs on Windows #471
Comments
Thanks for reporting @jamesjnadeau There is indeed a bug in the file path sent to nbdime. In #406, I did a correction. If you can could you try to install that branch to see if it fixes your problem? |
I'm logging what I did to try this out locally in the hopes this can be added to the docs later...
git clone git@github.com:fcollonval/jupyterlab-git.git
cd jupyterlab-git
git checkout plaintextdiff-cm
cd ..
pip install -e jupyterlab-git
jupyter serverextension enable --py jupyterlab_git
jupyter lab build
|
@fcollonval I tried to use your branch for pull#406 (see above steps I took) the I also tried Here's the error I see in jupyter labs output for the [E 08:48:50.261 LabApp] Uncaught exception POST /git/all_history?1575467330254 (::1)
HTTPServerRequest(protocol='http', host='localhost:8888', method='POST', uri='/git/all_history?1575467330254', version='HTTP/1.1', remote_ip='::1')
Traceback (most recent call last):
File "C:\Users\nadeauj\AppData\Roaming\Python\Python37\site-packages\tornado\web.py", line 1697, in _execute
result = method(*self.path_args, **self.path_kwargs)
File "c:\users\nadeauj\code\jupyterlab-git\jupyterlab_git\handlers.py", line 56, in post
history_count = body["history_count"]
KeyError: 'history_count'
[W 08:48:50.264 LabApp] Unhandled error
[E 08:48:50.265 LabApp] {
"Host": "localhost:8888",
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:70.0) Gecko/20100101 Firefox/70.0",
"Accept": "*/*",
"Accept-Language": "en-US,en;q=0.5",
"Accept-Encoding": "gzip, deflate",
"Referer": "http://localhost:8888/lab",
"Content-Type": "application/json",
"Origin": "http://localhost:8888",
"Content-Length": "19",
"Connection": "keep-alive",
"Pragma": "no-cache",
"Cache-Control": "no-cache"
}
[E 08:48:50.267 LabApp] 500 POST /git/all_history?1575467330254 (::1) 4.99ms referer=http://localhost:8888/lab reverting back to the version installed from conda allows the panel to work as expected(except the diff functionality of course). I'm happy to test this more if you like or provide further feedback. Feel free to tag me @fcollonval if you need a windows tester. |
@jamesjnadeau Thx for trying out. Actually you missed one step that rebuild the frontend extension. This is the source of the error you reported. The commands to install from git as dev are the following:
Note: if you could try it on the branch |
@fcollonval Thanks for the commands I missed, I was able to load the I am still unfortunately seeing the same error, where the Happy to help further. I have some free time later this week to dive into the code myself now that I have dev env set up. |
Thanks @jamesjnadeau for trying it out and sorry it did not fix the error. Feel free to look into it and propose a PR. The request is done there: https://github.com/jupyterlab/jupyterlab-git/blob/master/src/components/diff/NbDiff.tsx#L182-L186 So yes, the problem seems related to the file path being already absolute and the repo path being not appropriate. |
One thought, is your git root folder accessible from the Jupyterlab root folder? Or C:\path\git_repo\jupyterlab |
The root path I open Jupyter in(akathe root of the jupyters file browser) is my git repo. To say another way, the top most folder I can access in Jupyter contains my repo's I'm going to try specifying a folder up the hierarchy when launching Jupyter to see if that makes a difference. |
Moving where jupyter starts made no difference. I went up two directory levels and am still receiving the same error when loading a diff. |
Just to level set here, this repo is detected when opening jupyterlab-git. The diffs also work flawlessly in a docker linux container I have with pretty much the same packages installed. I believe this is something window's specific, yay M$.... :) |
I went down the rabit hole for a bit, and I belive I have found the issue, but I'll need to test fixing it, i'm logging my assumption here for reference. jupyterlab-git/jupyterlab_git/handlers.py Line 494 in f838270
doesn't exactly replicate what is going on in nbdime, there is a call to |
I successfully reproduce the bug. The error was coming from Line 627 in d6b27c6
|
this is my attempt to address jupyterlab#471
@fcollonval any update on this, happy to help if you can point me in a direction? I tried using the upath package to fix my issue, please see #516, but I imagine you'll want to make changes else where to fix this problem. I noticed that the git filters I set up(nbstripout) were also not working for on windows for this extension. I would see it returned a 'non zero' exit status. turning off these filters fixed the issue. These filters work in other git programs, so it's something to do with the way this extension is running things. Happy to start a new issue for it. |
@jamesjnadeau I just merged in #507. Can you please check if your issue is fixed in the latest master? #507 does basically the same thing as your #516, but it fixes the issue on the Python side (where the offending path originates). If #507 fixes the path issue but you still see the issue with the git filters, please open a new issue for that. |
@telamonian I just tried the latest master branch as of writing this. It took a bit of cache clearing, but it appears it works!!!!, unless you use git filters. I was not able to make this work with any git filter such as nbsctripout or fastai-nbstripout. Without any git filter, the extension works as expected. Here's the error reported by jupyter lab when using nbstripout installed globally: ''' uninstalling nbstripout makes diffing work as expected. running I feel this might be related to nbdime, but I'm not sure, I'm happy to submit a new issue as well, but right now this could be related? Thanks so much for your effort here so far! I really appreciate it. |
I think it might be related to this issue reported in nbdime: you might need to do something similar when calling the subprocess for diffing? |
@jamesjnadeau could you obtain the path use by nbdime in the filter call: https://github.com/jupyter/nbdime/blob/6259cd0936eecae3e0fbd4301ecc55f4a5e19bc2/nbdime/vcs/git/filter_integration.py#L77-L82 |
here's where my local copy of nbdime is in my path: (base) PS > where.exe nbdime.exe
C:\Users\username\AppData\Local\Continuum\miniconda3\Scripts\nbdime.exe I'm not clear on what you mean by
Based on my assumption that you want to know the contents of the 'path' variable in that function call, I installed nbdime locally and added the following python code above that line: print('path = ' + str(path)) When run from jupyter, this errors as before, and I see the following returned by my print statement:
Hope this helps, I'm set up to help more if you need it. Thanks again, I really appreciate you spending the time to figure this out for windows users. This extension is awesome, and makes jupyter lab a true IDE. |
@jamesjnadeau I looked at this a bit more. This is a bug with The filter command uses simple quote around the python executable path when it should be using double quote. The Windows console does not understand the single quote as string delimiter. I was able to reproduce the error on my computer. But from your error message, it looks you are not using the latest version of nbstripout. You got:
I got with nbstripout 0.3.7
Could you confirm that? |
@fcollonval Thanks for looking into this more! after updating to 0.3.7
I'm getting the following error in Jupyter lab when diffing a file:
I believe this confirms your assumption. Thanks again, and good catch on the quoting error! |
@jamesjnadeau Could we close this issue as the remaining error is not related to this package? |
I searched for other issues like this, but couldn't find any.
Description
I'm not able to get the diff tool to work on Windows. When trying to view a diff, the DiffWidget component displays an error. I believe this is related to paths being improperly passed to the backend for diffs when using windows paths.
I believe the function call here is causing the issue:
https://github.com/jupyterlab/jupyterlab-git/blob/master/src/components/diff/DiffWidget.tsx#L38
but I'm new here, so take that with a grain of salt 🤷♂
Reproduce
Failed to fetch diff with error:JSON.parse: unexpected character at line 1 column 1 of the JSON data
Expected behavior
I would expect to be able to view this diff on the windows platform.
Upon further inspection, I can see the following parameters passed in a Post to my lab server:
making the request without
../
infile_path
appears to fix the issue.I'm familiar with react but I'm not sure where in this project this is getting messed up, and I"m not set up to easily develop on this(although I'm totally willing to figure it out if someone can point me to some links to get up and running)
Context
Command Line Output
Browser Output
The text was updated successfully, but these errors were encountered: