jupyter-drive icon indicating copy to clipboard operation
jupyter-drive copied to clipboard

Error loading notebook

Open bmyerz opened this issue 8 years ago • 10 comments

$ ipython --version
3.2.0

$ python --version
Python 2.7.9

$uname -mprsv
Darwin 14.4.0 Darwin Kernel Version 14.4.0: Thu May 28 11:35:04 PDT 2015; root:xnu-2782.30.5~1/RELEASE_X86_64 x86_64 i386

I tried to open a ipynb file in my google drive and got this alert. There are no error logs printed by the ipython notebook server console.

image

image

bmyerz avatar Jul 07 '15 23:07 bmyerz

notebook is in v4 format

bmyerz avatar Jul 07 '15 23:07 bmyerz

I'm having the same problem; however, it's only true of notebooks that I uploaded to Google drive from my local file system. If I create a notebook while using jupyterdrive, I don't get this error.

@bmyerz , is that true for you too?

Zsailer avatar Jul 17 '15 20:07 Zsailer

Thanks @Zsailer I'll try to upload a file to see if this does that too.

Carreau avatar Jul 17 '15 21:07 Carreau

@Zsailer no, when I do new > Python 2, I get another error

image

Uncaught (in promise) TypeError: Cannot read property 'orig_nbformat' of undefined
    at Notebook.load_notebook_success (http://localhost:8889/static/notebook/js/notebook.js?v=20150717160647:2205:45)
    at x.isFunction.i (http://localhost:8889/static/components/jquery/jquery.min.js?v=20150717160647:4:5488)

I can successfully create a new text file.

bmyerz avatar Jul 17 '15 23:07 bmyerz

this is different and tracked/fix in progress into https://github.com/jupyter/jupyter-drive/pull/124

Carreau avatar Jul 17 '15 23:07 Carreau

@KesterTong for some files, (mostly one uploaded or shared with others) Files seem to not get the dowloadUrl anymore (docs seem to say it should ) . The thing that bother me is that the picker po-up everytime as if the App was not authorized. Could there be a problem there ?

Carreau avatar Jul 19 '15 22:07 Carreau

with the latest in master (ee58295), I no longer get this error when loading an existing notebook from drive

$ ipython --version
4.0.0
$ python --version
Python 2.7.9

bmyerz avatar Aug 27 '15 21:08 bmyerz

I get this error when loading an existing notebook created by someone else. I do not get it opening my own. The Drive sharing permissions allow me to edit the file, though I am not the owner of the file. The folder containing the file is shared. Reproduced in the reverse direction (the other user cannot open a file created by me, although the other user is allowed to edit the file). This is in python 2.7.3, ipython 4.0.0, and the latest jupyter-drive in master (ee58295).

I note that I'm able to open the other user's notebooks when running the notebook app on my laptop instead of my server. My laptop runs python 2.7.8. I attempted with python 2.7.10 on the server, but this didn't help.

I am setting CLIENT_ID in ~/.jupyter/nbconfig/common.json and I've authorized only this specific host with and without port 8888 for OAuth 2.0. I authorized as both a JavaScript origin and as an authorized redirect. I start the ipython notebook service specifically with this host name and port. The typical error linked to issue #21 goes away with these settings and allows me to move on and access my Google Drive.

Multiple users are logging into a shared jupyter notebook service and accessing each-other's notebooks. Jupyter-Drive checks for account authorization for each individual, so I infer the authorization is saved as client-side settings, not on the notebook server. We've attempted with and without simultaneous access attempts and simultaneous login.

In order to replicate the laptop environment as closely as possible on the server, I've attempted integrating Jupyter-Drive with JupyterHub. I've been unsuccessful. Somehow I'm not accessing OAuth from the correct server origins and/or redirect -- JupyterHub does lots of port forwarding and I've been unable to determine the appropriate list of ports in the API credentials for OAuth.

malina-kirn avatar Sep 23 '15 14:09 malina-kirn

I got the same error and I did some investigation. The requested scope is drive.file which only per-file access to files created or opened by the jupyter-drive. So, in this case, jupyter-drive does not have access to files created by other apps. You can change the scope to drive - Full, permissive scope to access all of a user's files. At least, it solved my problem. See: https://developers.google.com/drive/v2/web/scopes

szferi avatar Dec 25 '15 10:12 szferi

Thank you @szferi! That solved this problem for me. If anyone was having trouble with their own CLIENT_ID, this fixed it. It's not ideal, since it's more permissive than it should be but I'm not sure how else to fix this:

diff --git a/jupyterdrive/gdrive/gapiutils.js b/jupyterdrive/gdrive/gapiutils.js                                                                                                                                                             
index dc2d1d9..ddb6072 100644                                                                                                                                                                                                                
--- a/jupyterdrive/gdrive/gapiutils.js                                                                                                                                                                                                       
+++ b/jupyterdrive/gdrive/gapiutils.js                                                                                                                                                                                                       
@@ -22,7 +22,7 @@ define(["require", "exports", 'jquery', 'base/js/dialog', 'base/js/utils'], func                                                                                                                                           
      * by this app.                                                                                                                                                                                                                         
      * @type {string}
      */
-    var FILES_OAUTH_SCOPE = 'https://www.googleapis.com/auth/drive.file';
+    var FILES_OAUTH_SCOPE = 'https://www.googleapis.com/auth/drive';
     /**
      * OAuth scope for accessing file metadata (for tree view)
      * @type {string}

whitead avatar Apr 04 '16 20:04 whitead