-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Support Windows Paths #5051
Comments
I think the PyCharm UI here is the ideal to strive towards. In PyCharm only the filename is displayed, unless there is another tab with the same name open in which case parent folders are shown until the tabs are uniquely identified. e.g. for the folders shown below only the filename and parent folder are shown as those are sufficient to uniquely identify the file:
The key aspect for me is the most important information is chosen to be displayed - the least important information is the root of the filesystem as it is common to everything. |
I'm running 33.4 on win64, chrome 67.0.3396.99 Edit: Also seeing this in Firefox Developer 62.0b11 |
Hi @dhirschfeld, two questions:
I wasn't able to repro on Win 10 in Chrome 68. |
JupyterLab is launched with I can do some further testing when I'm back from holiday in a weeks time... |
Thanks, enjoy! |
I'm confused as to how pasting the full file path opened anything. The open file path is supposed to take a server path, with starts with |
I'll double check that. Was just quoting from memory. I'm sure I copied the path from an exception to open the file. That's a very useful capability to have IMHO which is why I start my server in |
What I tried locally was launching from |
Jupyter does not map directly to file system paths on purpose, because your "file system" could be a remote database. I'm not sure how I feel about allowing raw paths like that in general... |
Yep, NB: If I use forward slashes I'm about to update to |
The path utilities we're using in the browser assume unix-like paths, so we'd have to sanitize the input in that dialog first. |
Specifically, here. |
Just a note to say that being able to open files on the file system is critical functionality for me for debugging purposes. At present debugging is restricted somewhat to opening the library file and instrumenting with print statements but I can imagine a future where you could put a breakpoint in the file and step through it in the JupyterLab Debugger built on top of the Debug Adaptor Protocol |
So, originally I'm now on 0.34.11 and paths with backslashes in simply don't work at all :( I can of course manually edit all backslashes but that's pretty a painful UX for Windows users. |
Hello |
I don't think so, so go for it if you want! |
Do you think that automatically replacing all backslashes to forward slashes would solve the problem? |
@Zsailer So this issue would be fixed in Jupyter Server by fixing this issue jupyter-server/jupyter_server#34? If so, I would like to move this off 1.0. |
TODO @jasongrout: Try to reproduce this on a windows machine and see what is coming from the server. |
I reproduced this. I created
You'll notice that the name that came back included the If I do the same thing with So we could say this is a server issue, or we could say that the server api accepts unix-style paths, and we are not conforming to the api by sending a path that looks like |
@ivanov and I discussed this, and we think this is a problem with the server. The server api should not accept backslash paths, or paths that start with a drive letter. The server api is supposed to respond to url-style forward-slash-delimited paths, relative to the server root. We think there should be a different way to map between absolute paths given by a kernel and these server-relative paths. I'll open an issue in the notebook server. |
I created jupyter/notebook#4640. We'll close this for now as an upstream issue - feel free to continue the discussion on jupyter/notebook#4640 |
From a UX perspective, I'd like the to be able to open files by copying and pasting paths - which on Windows means accepting standard backslashes. It's very painful (and Windows hostile) to force users to manually change every backslash to a forward-slash. |
There are two separate potential issues I see here: A. Windows-style backslash paths vs url-style forward-slash paths that the api expects. We could provide this translation in JupyterLab, perhaps keyed to a setting. The B. Mapping absolute paths you see from kernels (like in tracebacks) to server-relative paths. The frontend can't really do this since it doesn't know how kernels and the server are related. Perhaps the server can provide some information to the frontend about how to appropriately map kernel paths to server contents api paths for various kernels. For example, in your case the server could tell the frontend "For this kernel, when you see a path like |
We could reopen this issue for a setting that would translate backslash paths in "Open from path..." to forward-slash paths. Would that ease the pain in the short term? |
I don't think you need any fancy translation since passing an absolute path actually works - all I would suggest is normalising path = path.replace('\\', '/')
if not path.startswith('/'):
assert path.startswith(self.serverRoot)
contents = self.get_contents(path)
name = os.path.basename(path) |
The fact that |
Yes, behind a setting that you manually set, right?
The security check already (should) happen on the server side. Reopening for the issue of "A filebrowser setting to normalize 'open from path' paths from |
Is a backslash a valid path character on linux? If so, then yeah I guess you'd have to opt into it. Alternatively you could match on |
backslash is a valid filename character on linux. |
So I think https://github.com/jupyterlab/jupyterlab/pull/5626/files can basically be resurrected, except instead of conditioning on the browser's operating system, we should condition on a setting. |
Moving to 1.1. If anyone can work on this in the next week, feel free and we can get it in 1.0. |
...as often (almost always) it won't fit and the most important part, the filename itself, is currently being truncated:
The text was updated successfully, but these errors were encountered: