nbmanager icon indicating copy to clipboard operation
nbmanager copied to clipboard

error at first start

Open ggrrll opened this issue 7 years ago • 4 comments

Hi, I just installed it and this is what I got at the launch (python3.6 -m nbmanager)

File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "~/Downloads/nbmanager-master/nbmanager/__main__.py", line 2, in <module>
    main()
  File "~/Downloads/nbmanager-master/nbmanager/gui.py", line 190, in main
    window = Main()
  File "~/Downloads/nbmanager-master/nbmanager/gui.py", line 70, in __init__
    self.populate_processes()
  File "~/Downloads/nbmanager-master/nbmanager/gui.py", line 105, in populate_processes
    self.add_server(server)
  File "~/Downloads/nbmanager-master/nbmanager/gui.py", line 91, in add_server
    for session in server.sessions():
  File "~/Downloads/nbmanager-master/nbmanager/api.py", line 59, in sessions
    self.last_sessions = r.json()
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/requests/models.py", line 866, in json
    return complexjson.loads(self.text, **kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/json/__init__.py", line 354, in loads
    return _default_decoder.decode(s)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/json/decoder.py", line 339, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/json/decoder.py", line 357, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

ggrrll avatar Jun 12 '17 09:06 ggrrll

Sounds like it's getting a non-JSON response back when it expects JSON. You could stick a print(r.content) in the code just before it calls r.json() to see what data it's getting.

takluyver avatar Jun 13 '17 10:06 takluyver

It's not getting JSON, but html. I have the same problem here on windows 10 and Python 3 (anaconda install)

b'<!DOCTYPE HTML>\n<html>\n\n<head>\n    <meta charset="utf-8">\n\n    <title>Jupyter Notebook</title>\n    <link rel="shortcut icon" type="image/x-icon" href="/static/base/images/favicon.ico?v=97c6417ed01bdc0ae3ef32ae4894fd03">\n    <meta http-equiv="X-UA-Compatible" content="IE=edge" />\n    <link rel="stylesheet" href="/static/components/jquery-ui/themes/smoothness/jquery-ui.min.css?v=9b2c8d3489227115310662a343fce11c" type="text/css" />\n    <link rel="stylesheet" href="/static/components/jquery-typeahead/dist/jquery.typeahead.min.css?v=7afb461de36accb1aa133a1710f5bc56" type="text/css" />\n    <meta name="viewport" content="width=device-width, initial-scale=1.0">\n    \n    \n\n    <link rel="stylesheet" href="/static/style/style.min.css?v=29c09309dd70e7fe93378815e5f022ae" type="text/css"/>\n    \n<link rel="stylesheet" href="/static/auth/css/override.css?v=19ec59d2c4f1203c49fe47462028cd9a" type="text/css" />\n\n    <link rel="stylesheet" href="/custom/custom.css" type="text/css" />\n    <script src="/static/components/es6-promise/promise.min.js?v=f004a16cb856e0ff11781d01ec5ca8fe" type="text/javascript" charset="utf-8"></script>\n    <script src="/static/components/preact/index.js?v=5b98fce8b86ce059de89f9e728e16957" type="text/javascript"></script>\n    <script src="/static/components/proptypes/index.js?v=c40890eb04df9811fcc4d47e53a29604" type="text/javascript"></script>\n    <script src="/static/components/preact-compat/index.js?v=d376eb109a00b9b2e8c0d30782eb6df7" type="text/javascript"></script>\n    <script src="/static/components/requirejs/require.js?v=6da8be361b9ee26c5e721e76c6d4afce" type="text/javascript" charset="utf-8"></script>\n    <script>\n      require.config({\n          \n          urlArgs: "v=20171109100945",\n          \n          baseUrl: \'/static/\',\n          paths: {\n            \'auth/js/main\': \'auth/js/main.min\',\n            custom : \'/custom\',\n            nbextensions : \'/nbextensions\',\n            kernelspecs : \'/kernelspecs\',\n            underscore : \'components/underscore/underscore-min\',\n            backbone : \'components/backbone/backbone-min\',\n            jquery: \'components/jquery/jquery.min\',\n            bootstrap: \'components/bootstrap/js/bootstrap.min\',\n            bootstraptour: \'components/bootstrap-tour/build/js/bootstrap-tour.min\',\n            \'jquery-ui\': \'components/jquery-ui/ui/minified/jquery-ui.min\',\n            moment: \'components/moment/moment\',\n            codemirror: \'components/codemirror\',\n            termjs: \'components/xterm.js/dist/xterm\',\n            typeahead: \'components/jquery-typeahead/dist/jquery.typeahead.min\',\n          },\n          map: { // for backward compatibility\n              "*": {\n                  "jqueryui": "jquery-ui",\n              }\n          },\n          shim: {\n            typeahead: {\n              deps: ["jquery"],\n              exports: "typeahead"\n            },\n            underscore: {\n              exports: \'_\'\n            },\n            backbone: {\n              deps: ["underscore", "jquery"],\n              exports: "Backbone"\n            },\n            bootstrap: {\n              deps: ["jquery"],\n              exports: "bootstrap"\n            },\n            bootstraptour: {\n              deps: ["bootstrap"],\n              exports: "Tour"\n            },\n            "jquery-ui": {\n              deps: ["jquery"],\n              exports: "$"\n            }\n          },\n          waitSeconds: 30,\n      });\n\n      require.config({\n          map: {\n              \'*\':{\n                \'contents\': \'services/contents\',\n              }\n          }\n      });\n\n      // error-catching custom.js shim.\n      define("custom", function (require, exports, module) {\n          try {\n              var custom = require(\'custom/custom\');\n              console.debug(\'loaded custom.js\');\n              return custom;\n          } catch (e) {\n              console.error("error loading custom.js", e);\n              return {};\n          }\n      })\n    </script>\n\n    \n    \n\n</head>\n\n<body class=""\n \n  \n \ndir="ltr">\n\n<noscript>\n    <div id=\'noscript\'>\n      Jupyter Notebook requires JavaScript.<br>\n      Please enable it to proceed.\n  </div>\n</noscript>\n\n<div id="header">\n  <div id="header-container" class="container">\n  <div id="ipython_notebook" class="nav navbar-brand pull-left"><a href="/tree" title=\'dashboard\'><img src=\'/static/base/images/logo.png?v=641991992878ee24c6f3826e81054a0f\' alt=\'Jupyter Notebook\'/></a></div>\n\n  \n  \n  \n\n\n  \n\n  \n  \n  </div>\n  <div class="header-bar"></div>\n\n  \n  \n</div>\n\n<div id="site">\n\n\n<div id="ipython-main-app" class="container">\n\n    \n    \n    <div class="row">\n    <div class="navbar col-sm-8">\n      <div class="navbar-inner">\n        <div class="container">\n          <div class="center-nav">\n            <p class="navbar-text nav">Password or token:</p>\n            <form action="/login?next=%2Fapi%2Fsessions%3Ftoken%3D58abadcc9af75082b6455434ed3e7da4ddba7dc2f295be82" method="post" class="navbar-form pull-left">\n              <input type="hidden" name="_xsrf" value="2|4ed163de|88d2088339303c2b0e6daca6ecd14808|1510234194"/>\n              <input type="password" name="password" id="password_input" class="form-control">\n              <button type="submit" id="login_submit">Log in</button>\n            </form>\n          </div>\n        </div>\n      </div>\n    </div>\n    </div>\n    \n    \n    \n    \n    <div class="col-sm-6 col-sm-offset-3 text-left rendered_html">\n      <h3>\n        Token authentication is enabled\n      </h3>\n      <p>\n        If no password has been configured, you need to open the notebook\n        server with its login token in the URL, or paste it above.\n        This requirement will be lifted if you\n        <b><a href=\'https://jupyter-notebook.readthedocs.io/en/stable/public_server.html\'>\n            enable a password</a></b>.\n      </p>\n      <p>\n        The command:\n        <pre>jupyter notebook list</pre>\n        will show you the URLs of running servers with their tokens,\n        which you can copy and paste into your browser. For example:\n      </p>\n      <pre>Currently running servers:\nhttp://localhost:8888/?token=c8de56fa... :: /Users/you/notebooks\n</pre>\n      <p>\n        or you can paste just the token value into the password field on this\n        page.\n      </p>\n      <p>\n        See\n        <b><a\n         href=\'https://jupyter-notebook.readthedocs.io/en/stable/public_server.html\'>\n                the documentation on how to enable a password</a>\n        </b>\n        in place of token authentication,\n        if you would like to avoid dealing with random tokens.\n      </p>\n      <p>\n        Cookies are required for authenticated access to notebooks.\n      </p>\n\n    </div>\n    \n    \n</div>\n\n\n</div>\n\n\n\n\n\n\n\n\n<script type="text/javascript">\n  require(["auth/js/main"], function (auth) {\n    auth.login_main();\n  });\n</script>\n\n\n\n<script type=\'text/javascript\'>\n  function _remove_token_from_url() {\n    if (window.location.search.length <= 1) {\n      return;\n    }\n    var search_parameters = window.location.search.slice(1).split(\'&\');\n    for (var i = 0; i < search_parameters.length; i++) {\n      if (search_parameters[i].split(\'=\')[0] === \'token\') {\n        // remote token from search parameters\n        search_parameters.splice(i, 1);\n        var new_search = \'\';\n        if (search_parameters.length) {\n          new_search = \'?\' + search_parameters.join(\'&\');\n        }\n        var new_url = window.location.origin + \n                      window.location.pathname + \n                      new_search + \n                      window.location.hash;\n        window.history.replaceState({}, "", new_url);\n        return;\n      }\n    }\n  }\n  _remove_token_from_url();\n</script>\n</body>\n\n</html>'

arocchi avatar Nov 09 '17 13:11 arocchi

Make sure you're using an up-to-date version from git - that HTML looks like it might be getting an older version which didn't send the authentication token.

takluyver avatar Nov 09 '17 17:11 takluyver

Hi @takluyver , yes I confirm I am using latest version from master at e45dad3007

arocchi avatar Nov 10 '17 11:11 arocchi