Closed hcmbg closed 6 years ago
Out of curiosity, what version of curl are you using? Also, could you post the results of ein:dev-bug-report-template
?
I'm also running into this error but in a sanboxed emacs install from MELPA. Here is the output I get from clicking on [New Notebook] (despite ein:notebooklist-login
) failing as recommended in this issue:
ein: [info] Creating a new notebook at ...
ein: [info] New notebook. Port: http://127.0.0.1:8888, Path:
REQUEST [debug] REQUEST
REQUEST [debug] Run: curl --silent --include --location --compressed --cookie /Users/ebanner/sandbox/request/curl-cookie-jar --cookie-jar /Users/ebanner/sandbox/request/curl-cookie-jar --write-out \n(:num-redirects %{num_redirects} :url-effective "%{url_effective}") --data-binary @/var/folders/tj/rvw6dyl51fgbh1lr0jqqm33m0000gn/T/emacs-requestl4c0Qw --request POST http://127.0.0.1:8888/api/contents
REQUEST [debug] REQUEST--CURL-CALLBACK event = finished
REQUEST [debug] REQUEST--CURL-CALLBACK proc = #<process request curl>
REQUEST [debug] REQUEST--CURL-CALLBACK buffer = #<buffer *request curl*>
REQUEST [debug] REQUEST--CURL-CALLBACK symbol-status = nil
REQUEST [debug] REQUEST--CALLBACK
REQUEST [debug] (buffer-string) =
HTTP/1.1 403 Forbidden
Server: TornadoServer/4.5.1
Content-Type: application/json
Date: Fri, 12 Jan 2018 05:20:59 GMT
Content-Security-Policy: frame-ancestors 'self'; report-uri /api/security/csp-report; default-src 'none'
Content-Length: 5907
<!DOCTYPE HTML>
<html>
.
.
.
</html>
REQUEST [debug] REQUEST-RESPONSE--CANCEL-TIMER
REQUEST [debug] -CLEAN-HEADER
REQUEST [debug] -CUT-HEADER
REQUEST [debug] error-thrown = (error http 403)
REQUEST [debug] -PARSE-DATA
REQUEST [debug] parser = ein:json-read
REQUEST [debug] data = nil
REQUEST [debug] symbol-status = error
REQUEST [debug] Executing error callback.
REQUEST [debug] -TIMEOUT-CALLBACK
Quit
As in that issue, the curl
command does not have a --header
argument.
ein: [info] Failed to login to 8888
403 POST /login (127.0.0.1): '_xsrf' argument missing from POST
git clone https://github.com/melpa/melpa.git
cd melpa
make recipes/<package-name>
EMACS_COMMAND=<path-to-emacs> make sandbox INSTALL=<package-name>`
M-x ein:notebooklist-login RET 8888 RET <password> RET
ipython --version
):6.2.1
ipython notebook --port 9999
):jupyter notebook
8888
("EIN system info"
:emacs-version
"GNU Emacs 27.0.50 (build 1, x86_64-apple-darwin15.6.0, NS appkit-1404.47 Version 10.11.6 (Build 15G31))
of 2017-11-04"
:emacs-bzr-version "d3233b437eb8757e3c5abc1b50f100ea53ca9e15"
:window-system ns
:emacs-variant nil
:os
(:uname
"Darwin Edwards-MacBook-Pro.local 15.6.0 Darwin Kernel Version 15.6.0: Thu Jun 23 18:25:34 PDT 2016; root:xnu-3248.60.10~1/RELEASE_X86_64 x86_64
"
:lsb-release nil)
:image-types
(svg imagemagick png gif tiff jpeg xpm xbm pbm)
:image-types-available
(svg imagemagick png gif tiff jpeg xpm xbm pbm)
:request
(:backend curl)
:ein
(:version "0.13.1"
:source-dir "/Users/ebanner/Documents/melpa/sandbox/elpa/ein-20171128.516/")
:lib
((:name "websocket"
:path "~/Documents/melpa/sandbox/elpa/websocket-20171113.2045/websocket.elc"
:featurep t
:version-var websocket-version
:version "1.9")
(:name "request"
:path "~/Documents/melpa/sandbox/elpa/request-20170131.1747/request.elc"
:featurep t
:version-var request-version
:version "0.3.0")
(:name "auto-complete"
:path "~/Documents/melpa/sandbox/elpa/auto-complete-20170124.1845/auto-complete.elc"
:featurep t
:version-var nil
:version nil)
(:name "auto-complete"
:path "~/Documents/melpa/sandbox/elpa/auto-complete-20170124.1845/auto-complete.elc"
:featurep t
:version-var nil
:version nil)
(:name "popup"
:path "~/Documents/melpa/sandbox/elpa/popup-20160709.729/popup.elc"
:featurep t
:version-var popup-version
:version "0.5.3")
(:name "python"
:path
"/usr/local/Cellar/emacs-plus/HEAD-d3233b4/share/emacs/27.0.50/lisp/progmodes/python.elc"
:featurep t
:version-var nil
:version nil)))
Interestingly EIN works flawlessly in my normal spacemacs setup:
("EIN system info"
:emacs-version
"GNU Emacs 25.3.1 (x86_64-apple-darwin15.6.0, NS appkit-1404.47 Version 10.11.6 (Build 15G31))
of 2017-11-04"
:emacs-bzr-version nil
:window-system ns
:emacs-variant nil
:os
(:uname
"Darwin Edwards-MacBook-Pro.local 15.6.0 Darwin Kernel Version 15.6.0: Thu Jun 23 18:25:34 PDT 2016; root:xnu-3248.60.10~1/RELEASE_X86_64 x86_64
"
:lsb-release nil)
:image-types
(svg imagemagick png gif tiff jpeg xpm xbm pbm)
:image-types-available
(svg imagemagick png gif tiff jpeg xpm xbm pbm)
:request
(:backend curl)
:ein
(:version "0.13.1"
:source-dir "/Users/ebanner/.emacs.d/elpa/ein-20171128.516/")
:lib
((:name "websocket"
:path "~/.emacs.d/elpa/websocket-20171113.2045/websocket.elc"
:featurep t
:version-var websocket-version
:version "1.9")
(:name "request"
:path "~/.emacs.d/elpa/request-20170131.1747/request.elc"
:featurep t
:version-var request-version
:version "0.3.0")
(:name "auto-complete"
:path "~/.emacs.d/elpa/auto-complete-20170124.1845/auto-complete.elc"
:featurep nil
:version-var nil
:version nil)
(:name "auto-complete"
:path "~/.emacs.d/elpa/auto-complete-20170124.1845/auto-complete.elc"
:featurep nil
:version-var nil
:version nil)
(:name "popup"
:path "~/.emacs.d/elpa/popup-20160709.729/popup.elc"
:featurep nil
:version-var nil
:version nil)
(:name "fuzzy"
:path "~/.emacs.d/elpa/fuzzy-20150729.2037/fuzzy.elc"
:featurep nil
:version-var nil
:version nil)
(:name "python"
:path "/usr/local/Cellar/emacs-plus/25.3/share/emacs/25.3/lisp/progmodes/python.elc"
:featurep nil
:version-var nil
:version nil)
(:name "markdown-mode"
:path "~/.emacs.d/elpa/markdown-mode-20171211.2209/markdown-mode.elc"
:featurep nil
:version-var nil
:version nil)
(:name "helm"
:path "~/.emacs.d/elpa/helm-core-20171130.2340/helm.elc"
:featurep t
:version-var nil
:version nil)))
and the result of clicking on [New Notebook] with (setq request-message-level t)
in spacemacs (this works fine!):
ein: [info] Creating a new notebook at ...
ein: [info] New notebook. Port: http://127.0.0.1:8888, Path:
REQUEST [debug] REQUEST
REQUEST [debug] Run: curl --silent --include --location --compressed --cookie /Users/ebanner/.emacs.d/.cache/request/curl-cookie-jar --cookie-jar /Users/ebanner/.emacs.d/.cache/request/curl-cookie-jar --write-out \n(:num-redirects %{num_redirects} :url-effective "%{url_effective}") --data-binary @/var/folders/tj/rvw6dyl51fgbh1lr0jqqm33m0000gn/T/emacs-request49422oA2 --request POST --header X-XSRFTOKEN: 2|d6d406f7|2004004c31326e72614e0d374215c539|1513898809 http://127.0.0.1:8888/api/contents
REQUEST [debug] REQUEST--CURL-CALLBACK event = finished
REQUEST [debug] REQUEST--CURL-CALLBACK proc = #<process request curl>
REQUEST [debug] REQUEST--CURL-CALLBACK buffer = #<buffer *request curl*>
REQUEST [debug] REQUEST--CURL-CALLBACK symbol-status = nil
REQUEST [debug] REQUEST--CALLBACK
REQUEST [debug] (buffer-string) =
HTTP/1.1 201 Created
Server: TornadoServer/4.5.1
Content-Type: application/json
Date: Fri, 12 Jan 2018 05:37:47 GMT
Content-Security-Policy: frame-ancestors 'self'; report-uri /api/security/csp-report; default-src 'none'
Location: /api/contents/Untitled2.ipynb
Last-Modified: Fri, 12 Jan 2018 05:37:47 GMT
Content-Length: 219
{"name": "Untitled2.ipynb", "path": "Untitled2.ipynb", "last_modified": "2018-01-12T05:37:47Z", "created": "2018-01-12T05:37:47Z", "content": null, "format": null, "mimetype": null, "writable": true, "type": "notebook"}
REQUEST [debug] REQUEST-RESPONSE--CANCEL-TIMER
REQUEST [debug] -CLEAN-HEADER
REQUEST [debug] -CUT-HEADER
REQUEST [debug] error-thrown = nil
REQUEST [debug] -PARSE-DATA
REQUEST [debug] parser = ein:json-read
REQUEST [debug] data = (:name Untitled2.ipynb :path Untitled2.ipynb :last_modified 2018-01-12T05:37:47Z :created 2018-01-12T05:37:47Z :content nil :format nil :mimetype nil :writable t :type notebook)
REQUEST [debug] symbol-status = success
REQUEST [debug] Executing success callback.
ein: [info] Creating a new notebook ()... Done.
ein: [info] Opening notebook Untitled2.ipynb...
REQUEST [debug] REQUEST
REQUEST [debug] Run: curl --silent --include --location --compressed --cookie /Users/ebanner/.emacs.d/.cache/request/curl-cookie-jar --cookie-jar /Users/ebanner/.emacs.d/.cache/request/curl-cookie-jar --write-out \n(:num-redirects %{num_redirects} :url-effective "%{url_effective}") --request GET --header X-XSRFTOKEN: 2|d6d406f7|2004004c31326e72614e0d374215c539|1513898809 http://127.0.0.1:8888/api/contents/Untitled2.ipynb
REQUEST [debug] Start timer: timeout=60.0 sec
REQUEST [debug] REQUEST
REQUEST [debug] Run: curl --silent --include --location --compressed --cookie /Users/ebanner/.emacs.d/.cache/request/curl-cookie-jar --cookie-jar /Users/ebanner/.emacs.d/.cache/request/curl-cookie-jar --write-out \n(:num-redirects %{num_redirects} :url-effective "%{url_effective}") --request GET --header X-XSRFTOKEN: 2|d6d406f7|2004004c31326e72614e0d374215c539|1513898809 http://127.0.0.1:8888/api/contents/
REQUEST [debug] Start timer: timeout=60.0 sec
REQUEST [debug] REQUEST--CURL-CALLBACK event = finished
REQUEST [debug] REQUEST--CURL-CALLBACK proc = #<process request curl<1>>
REQUEST [debug] REQUEST--CURL-CALLBACK buffer = #<buffer *request curl*-542845>
REQUEST [debug] REQUEST--CURL-CALLBACK symbol-status = nil
REQUEST [debug] REQUEST--CALLBACK
REQUEST [debug] (buffer-string) =
HTTP/1.1 200 OK
Server: TornadoServer/4.5.1
Content-Type: application/json
Date: Fri, 12 Jan 2018 05:37:47 GMT
Content-Security-Policy: frame-ancestors 'self'; report-uri /api/security/csp-report; default-src 'none'
Last-Modified: Fri, 12 Jan 2018 05:37:47 GMT
Etag: "10443487ed8fdeaa020b7c4db9a1ed79c88d8c55"
Content-Length: 4801
{"name": "", "path": "", "last_modified": "2018-01-12T05:37:47Z", "created": "2018-01-12T05:37:47Z", "content": [{"name": "cfg", "path": "cfg", "last_modified": "2018-01-10T04:44:27Z", "created": "2018-01-10T04:44:27Z", "content": null, "format": null, "mimetype": null, "writable": true, "type": "directory"}, {"name": "features", "path": "features", "last_modified": "2018-01-10T04:44:27Z", "created": "2018-01-10T04:44:27Z", "content": null, "format": null, "mimetype": null, "writable": true, "type": "directory"}, {"name": "html", "path": "html", "last_modified": "2018-01-10T04:44:27Z", "created": "2018-01-10T04:44:27Z", "content": null, "format": null, "mimetype": null, "writable": true, "type": "directory"}, {"name": "package-build", "path": "package-build", "last_modified": "2018-01-10T04:44:27Z", "created": "2018-01-10T04:44:27Z", "content": null, "format": null, "mimetype": null, "writable": true, "type": "directory"}, {"name": "packages", "path": "packages", "last_modified": "2018-01-12T05:19:17Z", "created": "2018-01-12T05:19:17Z", "content": null, "format": null, "mimetype": null, "writable": true, "type": "directory"}, {"name": "recipes", "path": "recipes", "last_modified": "2018-01-10T05:07:37Z", "created": "2018-01-10T05:07:37Z", "content": null, "format": null, "mimetype": null, "writable": true, "type": "directory"}, {"name": "sandbox", "path": "sandbox", "last_modified": "2018-01-12T05:19:53Z", "created": "2018-01-12T05:19:53Z", "content": null, "format": null, "mimetype": null, "writable": true, "type": "directory"}, {"name": "scripts", "path": "scripts", "last_modified": "2018-01-10T04:44:27Z", "created": "2018-01-10T04:44:27Z", "content": null, "format": null, "mimetype": null, "writable": true, "type": "directory"}, {"name": "service", "path": "service", "last_modified": "2018-01-10T04:44:27Z", "created": "2018-01-10T04:44:27Z", "content": null, "format": null, "mimetype": null, "writable": true, "type": "directory"}, {"name": "tests", "path": "tests", "last_modified": "2018-01-10T04:44:27Z", "created": "2018-01-10T04:44:27Z", "content": null, "format": null, "mimetype": null, "writable": true, "type": "directory"}, {"name": "working", "path": "working", "last_modified": "2018-01-10T04:48:05Z", "created": "2018-01-10T04:48:05Z", "content": null, "format": null, "mimetype": null, "writable": true, "type": "directory"}, {"name": "Untitled.ipynb", "path": "Untitled.ipynb", "last_modified": "2018-01-12T04:49:03Z", "created": "2018-01-12T04:49:03Z", "content": null, "format": null, "mimetype": null, "writable": true, "type": "notebook"}, {"name": "Untitled1.ipynb", "path": "Untitled1.ipynb", "last_modified": "2018-01-12T05:36:57Z", "created": "2018-01-12T05:36:57Z", "content": null, "format": null, "mimetype": null, "writable": true, "type": "notebook"}, {"name": "Untitled2.ipynb", "path": "Untitled2.ipynb", "last_modified": "2018-01-12T05:37:47Z", "created": "2018-01-12T05:37:47Z", "content": null, "format": null, "mimetype": null, "writable": true, "type": "notebook"}, {"name": "Cask", "path": "Cask", "last_modified": "2018-01-10T04:44:27Z", "created": "2018-01-10T04:44:27Z", "content": null, "format": null, "mimetype": null, "writable": true, "type": "file"}, {"name": "CONTRIBUTING.md", "path": "CONTRIBUTING.md", "last_modified": "2018-01-10T04:44:27Z", "created": "2018-01-10T04:44:27Z", "content": null, "format": null, "mimetype": null, "writable": true, "type": "file"}, {"name": "LICENSE.md", "path": "LICENSE.md", "last_modified": "2018-01-10T04:44:27Z", "created": "2018-01-10T04:44:27Z", "content": null, "format": null, "mimetype": null, "writable": true, "type": "file"}, {"name": "Makefile", "path": "Makefile", "last_modified": "2018-01-10T04:44:27Z", "created": "2018-01-10T04:44:27Z", "content": null, "format": null, "mimetype": null, "writable": true, "type": "file"}, {"name": "migrate", "path": "migrate", "last_modified": "2018-01-10T04:44:27Z", "created": "2018-01-10T04:44:27Z", "content": null, "format": null, "mimetype": null, "writable": true, "type": "file"}, {"name": "README.md", "path": "README.md", "last_modified": "2018-01-10T04:44:27Z", "created": "2018-01-10T04:44:27Z", "content": null, "format": null, "mimetype": null, "writable": true, "type": "file"}, {"name": "run-travis-ci.sh", "path": "run-travis-ci.sh", "last_modified": "2018-01-10T04:44:27Z", "created": "2018-01-10T04:44:27Z", "content": null, "format": null, "mimetype": "application/x-sh", "writable": true, "type": "file"}, {"name": "travis-changed-files", "path": "travis-changed-files", "last_modified": "2018-01-10T04:44:27Z", "created": "2018-01-10T04:44:27Z", "content": null, "format": null, "mimetype": null, "writable": true, "type": "file"}], "format": "json", "mimetype": null, "writable": true, "type": "directory"}
REQUEST [debug] REQUEST-RESPONSE--CANCEL-TIMER
REQUEST [debug] -CLEAN-HEADER
REQUEST [debug] -CUT-HEADER
REQUEST [debug] error-thrown = nil
REQUEST [debug] -PARSE-DATA
REQUEST [debug] parser = ein:json-read
REQUEST [debug] data = (:name :path :last_modified 2018-01-12T05:37:47Z :created 2018-01-12T05:37:47Z :content ((:name cfg :path cfg :last_modified 2018-01-10T04:44:27Z :created 2018-01-10T04:44:27Z :content nil :format nil :mimetype nil :writable t :type directory) (:name features :path features :last_modified 2018-01-10T04:44:27Z :created 2018-01-10T04:44:27Z :content nil :format nil :mimetype nil :writable t :type directory) (:name html :path html :last_modified 2018-01-10T04:44:27Z :created 2018-01-10T04:44:27Z :content nil :format nil :mimetype nil :writable t :type directory) (:name package-build :path package-build :last_modified 2018-01-10T04:44:27Z :created 2018-01-10T04:44:27Z :content nil :format nil :mimetype nil :writable t :type directory) (:name packages :path packages :last_modified 2018-01-12T05:19:17Z :created 2018-01-12T05:19:17Z :content nil :format nil :mimetype nil :writable t :type directory) (:name recipes :path recipes :last_modified 2018-01-10T05:07:37Z :created 2018-01-10T05:07:37Z :content nil :format nil :mimetype nil :writable t :type directory) (:name sandbox :path sandbox :last_modified 2018-01-12T05:19:53Z :created 2018-01-12T05:19:53Z :content nil :format nil :mimetype nil :writable t :type directory) (:name scripts :path scripts :last_modified 2018-01-10T04:44:27Z :created 2018-01-10T04:44:27Z :content nil :format nil :mimetype nil :writable t :type directory) (:name service :path service :last_modified 2018-01-10T04:44:27Z :created 2018-01-10T04:44:27Z :content nil :format nil :mimetype nil :writable t :type directory) (:name tests :path tests :last_modified 2018-01-10T04:44:27Z :created 2018-01-10T04:44:27Z :content nil :format nil :mimetype nil :writable t :type directory) (:name working :path working :last_modified 2018-01-10T04:48:05Z :created 2018-01-10T04:48:05Z :content nil :format nil :mimetype nil :writable t :type directory) (:name Untitled.ipynb :path Untitled.ipynb :last_modified 2018-01-12T04:49:03Z :created 2018-01-12T04:49:03Z :content nil :format nil :mimetype nil :writable t :type notebook) (:name Untitled1.ipynb :path Untitled1.ipynb :last_modified 2018-01-12T05:36:57Z :created 2018-01-12T05:36:57Z :content nil :format nil :mimetype nil :writable t :type notebook) (:name Untitled2.ipynb :path Untitled2.ipynb :last_modified 2018-01-12T05:37:47Z :created 2018-01-12T05:37:47Z :content nil :format nil :mimetype nil :writable t :type notebook) (:name Cask :path Cask :last_modified 2018-01-10T04:44:27Z :created 2018-01-10T04:44:27Z :content nil :format nil :mimetype nil :writable t :type file) (:name CONTRIBUTING.md :path CONTRIBUTING.md :last_modified 2018-01-10T04:44:27Z :created 2018-01-10T04:44:27Z :content nil :format nil :mimetype nil :writable t :type file) (:name LICENSE.md :path LICENSE.md :last_modified 2018-01-10T04:44:27Z :created 2018-01-10T04:44:27Z :content nil :format nil :mimetype nil :writable t :type file) (:name Makefile :path Makefile :last_modified 2018-01-10T04:44:27Z :created 2018-01-10T04:44:27Z :content nil :format nil :mimetype nil :writable t :type file) (:name migrate :path migrate :last_modified 2018-01-10T04:44:27Z :created 2018-01-10T04:44:27Z :content nil :format nil :mimetype nil :writable t :type file) (:name README.md :path README.md :last_modified 2018-01-10T04:44:27Z :created 2018-01-10T04:44:27Z :content nil :format nil :mimetype nil :writable t :type file) (:name run-travis-ci.sh :path run-travis-ci.sh :last_modified 2018-01-10T04:44:27Z :created 2018-01-10T04:44:27Z :content nil :format nil :mimetype application/x-sh :writable t :type file) (:name travis-changed-files :path travis-changed-files :last_modified 2018-01-10T04:44:27Z :created 2018-01-10T04:44:27Z :content nil :format nil :mimetype nil :writable t :type file)) :format json :mimetype nil :writable t :type directory)
REQUEST [debug] symbol-status = success
REQUEST [debug] Executing success callback.
REQUEST [debug] REQUEST
REQUEST [debug] Run: curl --silent --include --location --compressed --cookie /Users/ebanner/.emacs.d/.cache/request/curl-cookie-jar --cookie-jar /Users/ebanner/.emacs.d/.cache/request/curl-cookie-jar --write-out \n(:num-redirects %{num_redirects} :url-effective "%{url_effective}") --request GET --header X-XSRFTOKEN: 2|d6d406f7|2004004c31326e72614e0d374215c539|1513898809 http://127.0.0.1:8888/api/sessions
REQUEST [debug] REQUEST--CURL-CALLBACK event = finished
REQUEST [debug] REQUEST--CURL-CALLBACK proc = #<process request curl<1>>
REQUEST [debug] REQUEST--CURL-CALLBACK buffer = #<buffer *request curl*-277651>
REQUEST [debug] REQUEST--CURL-CALLBACK symbol-status = nil
REQUEST [debug] REQUEST--CALLBACK
REQUEST [debug] (buffer-string) =
HTTP/1.1 200 OK
Server: TornadoServer/4.5.1
Content-Type: application/json
Date: Fri, 12 Jan 2018 05:37:48 GMT
Content-Security-Policy: frame-ancestors 'self'; report-uri /api/security/csp-report; default-src 'none'
Etag: "97d170e1550eee4afc0af065b78cda302a97674c"
Content-Length: 2
[]
REQUEST [debug] REQUEST-RESPONSE--CANCEL-TIMER
REQUEST [debug] -CLEAN-HEADER
REQUEST [debug] -CUT-HEADER
REQUEST [debug] error-thrown = nil
REQUEST [debug] -PARSE-DATA
REQUEST [debug] parser = ein:json-read
REQUEST [debug] data = nil
REQUEST [debug] symbol-status = success
REQUEST [debug] Executing success callback.
REQUEST [debug] REQUEST--CURL-CALLBACK event = finished
REQUEST [debug] REQUEST--CURL-CALLBACK proc = #<process request curl>
REQUEST [debug] REQUEST--CURL-CALLBACK buffer = #<buffer *request curl*>
REQUEST [debug] REQUEST--CURL-CALLBACK symbol-status = nil
REQUEST [debug] REQUEST--CALLBACK
REQUEST [debug] (buffer-string) =
HTTP/1.1 200 OK
Server: TornadoServer/4.5.1
Content-Type: application/json
Date: Fri, 12 Jan 2018 05:37:47 GMT
Content-Security-Policy: frame-ancestors 'self'; report-uri /api/security/csp-report; default-src 'none'
Last-Modified: Fri, 12 Jan 2018 05:37:47 GMT
Etag: "d82c1ad965e47590b75db672289edbd0c954ad0e"
Content-Length: 282
{"name": "Untitled2.ipynb", "path": "Untitled2.ipynb", "last_modified": "2018-01-12T05:37:47Z", "created": "2018-01-12T05:37:47Z", "content": {"cells": [], "metadata": {}, "nbformat": 4, "nbformat_minor": 2}, "format": "json", "mimetype": null, "writable": true, "type": "notebook"}
REQUEST [debug] REQUEST-RESPONSE--CANCEL-TIMER
REQUEST [debug] -CLEAN-HEADER
REQUEST [debug] -CUT-HEADER
REQUEST [debug] error-thrown = nil
REQUEST [debug] -PARSE-DATA
REQUEST [debug] parser = ein:json-read
REQUEST [debug] data = (:name Untitled2.ipynb :path Untitled2.ipynb :last_modified 2018-01-12T05:37:47Z :created 2018-01-12T05:37:47Z :content (:cells nil :metadata nil :nbformat 4 :nbformat_minor 2) :format json :mimetype nil :writable t :type notebook)
REQUEST [debug] symbol-status = success
REQUEST [debug] Executing success callback.
REQUEST [debug] REQUEST
REQUEST [debug] Run: curl --silent --include --location --compressed --cookie /Users/ebanner/.emacs.d/.cache/request/curl-cookie-jar --cookie-jar /Users/ebanner/.emacs.d/.cache/request/curl-cookie-jar --write-out \n(:num-redirects %{num_redirects} :url-effective "%{url_effective}") --data-binary @/var/folders/tj/rvw6dyl51fgbh1lr0jqqm33m0000gn/T/emacs-request49422aKF --request POST --header X-XSRFTOKEN: 2|d6d406f7|2004004c31326e72614e0d374215c539|1513898809 http://127.0.0.1:8888/api/sessions
ein: [info] Reading nbformat4 notebook.
ein: [info] Worksheet Untitled2.ipynb is ready
ein: [info] Enabling autosaves for Untitled2.ipynb with frequency 60 seconds.
ein: [info] Notebook Untitled2.ipynb is ready
REQUEST [debug] REQUEST--CURL-CALLBACK event = finished
REQUEST [debug] REQUEST--CURL-CALLBACK proc = #<process request curl>
REQUEST [debug] REQUEST--CURL-CALLBACK buffer = #<buffer *request curl*>
REQUEST [debug] REQUEST--CURL-CALLBACK symbol-status = nil
REQUEST [debug] REQUEST--CALLBACK
REQUEST [debug] (buffer-string) =
HTTP/1.1 201 Created
Server: TornadoServer/4.5.1
Content-Type: application/json
Date: Fri, 12 Jan 2018 05:37:48 GMT
Content-Security-Policy: frame-ancestors 'self'; report-uri /api/security/csp-report; default-src 'none'
Location: /api/sessions/46239d9b-816a-4d75-98a9-705421da6fa4
Content-Length: 336
{"id": "46239d9b-816a-4d75-98a9-705421da6fa4", "path": "Untitled2.ipynb", "name": null, "type": "notebook", "kernel": {"id": "643d5b65-6950-41f3-9124-04daf069b7b6", "name": "python3", "last_activity": "2018-01-12T05:37:48.775044Z", "execution_state": "starting", "connections": 0}, "notebook": {"path": "Untitled2.ipynb", "name": null}}
REQUEST [debug] REQUEST-RESPONSE--CANCEL-TIMER
REQUEST [debug] -CLEAN-HEADER
REQUEST [debug] -CUT-HEADER
REQUEST [debug] error-thrown = nil
REQUEST [debug] -PARSE-DATA
REQUEST [debug] parser = ein:json-read
REQUEST [debug] data = (:id 46239d9b-816a-4d75-98a9-705421da6fa4 :path Untitled2.ipynb :name nil :type notebook :kernel (:id 643d5b65-6950-41f3-9124-04daf069b7b6 :name python3 :last_activity 2018-01-12T05:37:48.775044Z :execution_state starting :connections 0) :notebook (:path Untitled2.ipynb :name nil))
REQUEST [debug] symbol-status = success
REQUEST [debug] Executing success callback.
ein: [info] Kernel started: 643d5b65-6950-41f3-9124-04daf069b7b6
ein: [info] Starting channels WS: "ws://127.0.0.1:8888/api/kernels/643d5b65-6950-41f3-9124-04daf069b7b6/channels?session_id=46239d9b-816a-4d75-98a9-705421da6fa4"
ein: [info] Opened notebook list at http://127.0.0.1:8888 with path .
Mark saved where search started [2 times]
Notice the curl
commands do have the --header
arguments!
OK I just started a fresh spacemacs install and was able to ein:notebooklist-login
and ein:notebooklist-open
and create a [New Notebook] just fine.
Curiously I still get the 403 POST /login (127.0.0.1): '_xsrf' argument missing from POST
so I don't think it's the root cause of the issue.
[I 15:52:15.067 NotebookApp] Accepting one-time-token-authenticated connection from ::1
[W 15:53:36.764 NotebookApp] 403 POST /login (127.0.0.1): '_xsrf' argument missing from POST
[W 15:53:36.771 NotebookApp] 403 POST /login (127.0.0.1) 8.26ms referer=None
[I 15:53:37.779 NotebookApp] 302 POST /login (127.0.0.1) 1.22ms
[W 15:53:37.781 NotebookApp] 405 POST / (127.0.0.1) 0.56ms referer=None
[I 15:53:57.989 NotebookApp] Creating new notebook in
[I 15:53:58.144 NotebookApp] Kernel started: 9f2de702-b08a-4ab9-807f-f6b8a85d7f08
$ mkdir ~/spacemacs
$ git clone git@github.com:syl20bnr/spacemacs.git ~/spacemacs/.emacs.d
$ HOME=~/spacemacs /Applications/Emacs.app/Contents/MacOS/Emacs
C-f /path/to/my/package/which/has/ein/as/a/dependency RET
M-x RET package-build-current-recipe RET
M-x ein:notebooklist-login RET 8888 RET <password> RET
("EIN system info"
:emacs-version
"GNU Emacs 25.3.1 (x86_64-apple-darwin15.6.0, NS appkit-1404.47 Version 10.11.6 (Build 15G31))
of 2017-11-04"
:emacs-bzr-version nil
:window-system ns
:emacs-variant nil
:os
(:uname
"Darwin Edwards-MacBook-Pro.local 15.6.0 Darwin Kernel Version 15.6.0: Thu Jun 23 18:25:34 PDT 2016; root:xnu-3248.60.10~1/RELEASE_X86_64 x86_64
"
:lsb-release nil)
:image-types
(svg imagemagick png gif tiff jpeg xpm xbm pbm)
:image-types-available
(svg imagemagick png gif tiff jpeg xpm xbm pbm)
:request
(:backend curl)
:ein
(:version "0.13.1"
:source-dir "/Users/ebanner/spacemacs/.emacs.d/elpa/ein-20171128.516/")
:lib
((:name "websocket"
:path "~/.emacs.d/elpa/websocket-20171113.2045/websocket.elc"
:featurep t
:version-var websocket-version
:version "1.9")
(:name "request"
:path "~/.emacs.d/elpa/request-20170131.1747/request.elc"
:featurep t
:version-var request-version
:version "0.3.0")
(:name "auto-complete"
:path "~/.emacs.d/elpa/auto-complete-20170124.1845/auto-complete.elc"
:featurep t
:version-var nil
:version nil)
(:name "auto-complete"
:path "~/.emacs.d/elpa/auto-complete-20170124.1845/auto-complete.elc"
:featurep t
:version-var nil
:version nil)
(:name "popup"
:path "~/.emacs.d/elpa/popup-20160709.729/popup.elc"
:featurep t
:version-var popup-version
:version "0.5.3")
(:name "python"
:path "/usr/local/Cellar/emacs-plus/25.3/share/emacs/25.3/lisp/progmodes/python.elc"
:featurep t
:version-var nil
:version nil)))
One clear difference we can see between the melpa sandboxed emacs and the spacemacs setup is that the former is GNU Emacs 27.0.50
and the latter is GNU Emacs 25.3.1
.
Any chance this is related to the root cause of the problem?
I realized I had an environment-variable related bug in my MELPA sandbox which caused the emacs versions to differ. Here's the System Info for a sandboxed MELPA instance running 25.3.1 but still fails ein:notebooklist-login
.
("EIN system info"
:emacs-version
"GNU Emacs 25.3.1 (x86_64-apple-darwin15.6.0, NS appkit-1404.47 Version 10.11.6 (Build 15G31))
of 2017-11-04"
:emacs-bzr-version nil
:window-system ns
:emacs-variant nil
:os
(:uname
"Darwin Edwards-MacBook-Pro.local 15.6.0 Darwin Kernel Version 15.6.0: Thu Jun 23 18:25:34 PDT 2016; root:xnu-3248.60.10~1/RELEASE_X86_64 x86_64
"
:lsb-release nil)
:image-types
(svg imagemagick png gif tiff jpeg xpm xbm pbm)
:image-types-available
(svg imagemagick png gif tiff jpeg xpm xbm pbm)
:request
(:backend curl)
:ein
(:version "0.13.1"
:source-dir "/Users/ebanner/Documents/melpa/sandbox/elpa/ein-20171128.516/")
:lib
((:name "websocket"
:path "~/Documents/melpa/sandbox/elpa/websocket-20171113.2045/websocket.elc"
:featurep t
:version-var websocket-version
:version "1.9")
(:name "request"
:path "~/Documents/melpa/sandbox/elpa/request-20170131.1747/request.elc"
:featurep t
:version-var request-version
:version "0.3.0")
(:name "auto-complete"
:path "~/Documents/melpa/sandbox/elpa/auto-complete-20170124.1845/auto-complete.elc"
:featurep t
:version-var nil
:version nil)
(:name "auto-complete"
:path "~/Documents/melpa/sandbox/elpa/auto-complete-20170124.1845/auto-complete.elc"
:featurep t
:version-var nil
:version nil)
(:name "popup"
:path "~/Documents/melpa/sandbox/elpa/popup-20160709.729/popup.elc"
:featurep t
:version-var popup-version
:version "0.5.3")
(:name "python"
:path "/usr/local/Cellar/emacs-plus/25.3/share/emacs/25.3/lisp/progmodes/python.elc"
:featurep t
:version-var nil
:version nil)))
Huh so now I'm stumped. System info is the same for the MELPA sanboxed instance and the spacemacs instance, yet the spacemacs instance works while the MELPA one doesn't...
So going back to the strategy in this issue of doing (setq request-message-level 'debug)
here is the output in the sandboxed MELPA instance:
REQUEST [debug] REQUEST
REQUEST [debug] Run: curl --silent --include --location --compressed --cookie /Users/ebanner/sandbox/request/curl-cookie-jar --cookie-jar /Users/ebanner/sandbox/request/curl-cookie-jar --write-out \n(:num-redirects %{num_redirects} :url-effective "%{url_effective}") --data-binary @/var/folders/tj/rvw6dyl51fgbh1lr0jqqm33m0000gn/T/emacs-request84111dnu --request POST http://127.0.0.1:8888/login
REQUEST [debug] REQUEST--CURL-CALLBACK event = finished
REQUEST [debug] REQUEST--CURL-CALLBACK proc = #<process request curl>
REQUEST [debug] REQUEST--CURL-CALLBACK buffer = #<buffer *request curl*>
REQUEST [debug] REQUEST--CURL-CALLBACK symbol-status = nil
REQUEST [debug] REQUEST--CALLBACK
REQUEST [debug] (buffer-string) =
HTTP/1.1 403 Forbidden
Server: TornadoServer/4.5.1
Content-Type: text/html
Date: Sun, 14 Jan 2018 00:51:20 GMT
Content-Security-Policy: frame-ancestors 'self'; report-uri /api/security/csp-report
Content-Length: 5907
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>Jupyter Notebook</title>
<link rel="shortcut icon" type="image/x-icon" href="/static/base/images/favicon.ico?v=97c6417ed01bdc0ae3ef32ae4894fd03">
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<link rel="stylesheet" href="/static/components/jquery-ui/themes/smoothness/jquery-ui.min.css?v=9b2c8d3489227115310662a343fce11c" type="text/css" />
<link rel="stylesheet" href="/static/components/jquery-typeahead/dist/jquery.typeahead.min.css?v=7afb461de36accb1aa133a1710f5bc56" type="text/css" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="/static/style/style.min.css?v=29c09309dd70e7fe93378815e5f022ae" type="text/css"/>
<style type="text/css">
/* disable initial hide */
div#header, div#site {
display: block;
}
</style>
<link rel="stylesheet" href="/custom/custom.css" type="text/css" />
<script src="/static/components/es6-promise/promise.min.js?v=f004a16cb856e0ff11781d01ec5ca8fe" type="text/javascript" charset="utf-8"></script>
<script src="/static/components/preact/index.js?v=5b98fce8b86ce059de89f9e728e16957" type="text/javascript"></script>
<script src="/static/components/proptypes/index.js?v=c40890eb04df9811fcc4d47e53a29604" type="text/javascript"></script>
<script src="/static/components/preact-compat/index.js?v=d376eb109a00b9b2e8c0d30782eb6df7" type="text/javascript"></script>
<script src="/static/components/requirejs/require.js?v=6da8be361b9ee26c5e721e76c6d4afce" type="text/javascript" charset="utf-8"></script>
<script>
require.config({
urlArgs: "v=20180113165016",
baseUrl: '/static/',
paths: {
'auth/js/main': 'auth/js/main.min',
custom : '/custom',
nbextensions : '/nbextensions',
kernelspecs : '/kernelspecs',
underscore : 'components/underscore/underscore-min',
backbone : 'components/backbone/backbone-min',
jquery: 'components/jquery/jquery.min',
bootstrap: 'components/bootstrap/js/bootstrap.min',
bootstraptour: 'components/bootstrap-tour/build/js/bootstrap-tour.min',
'jquery-ui': 'components/jquery-ui/ui/minified/jquery-ui.min',
moment: 'components/moment/moment',
codemirror: 'components/codemirror',
termjs: 'components/xterm.js/dist/xterm',
typeahead: 'components/jquery-typeahead/dist/jquery.typeahead.min',
},
map: { // for backward compatibility
"*": {
"jqueryui": "jquery-ui",
}
},
shim: {
typeahead: {
deps: ["jquery"],
exports: "typeahead"
},
underscore: {
exports: '_'
},
backbone: {
deps: ["underscore", "jquery"],
exports: "Backbone"
},
bootstrap: {
deps: ["jquery"],
exports: "bootstrap"
},
bootstraptour: {
deps: ["bootstrap"],
exports: "Tour"
},
"jquery-ui": {
deps: ["jquery"],
exports: "$"
}
},
waitSeconds: 30,
});
require.config({
map: {
'*':{
'contents': 'services/contents',
}
}
});
// error-catching custom.js shim.
define("custom", function (require, exports, module) {
try {
var custom = require('custom/custom');
console.debug('loaded custom.js');
return custom;
} catch (e) {
console.error("error loading custom.js", e);
return {};
}
})
</script>
</head>
<body class=""
data-jupyter-api-token="d51a3c533a6b720ea73d826dfb0c238c8614fcd1f90e8059"
dir="ltr">
<noscript>
<div id='noscript'>
Jupyter Notebook requires JavaScript.<br>
Please enable it to proceed.
</div>
</noscript>
<div id="header">
<div id="header-container" class="container">
<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>
</div>
<div class="header-bar"></div>
</div>
<div id="site">
<div class="error">
<h1>403 : Forbidden</h1>
<p>The error was:</p>
<div class="traceback-wrapper">
<pre class="traceback">'_xsrf' argument missing from POST</pre>
</div>
</header>
</div>
<script type='text/javascript'>
require(['jquery'], function($) {
// scroll long tracebacks to the bottom
var tb = $(".traceback")[0];
tb.scrollTop = tb.scrollHeight;
});
</script>
<script type='text/javascript'>
function _remove_token_from_url() {
if (window.location.search.length <= 1) {
return;
}
var search_parameters = window.location.search.slice(1).split('&');
for (var i = 0; i < search_parameters.length; i++) {
if (search_parameters[i].split('=')[0] === 'token') {
// remote token from search parameters
search_parameters.splice(i, 1);
var new_search = '';
if (search_parameters.length) {
new_search = '?' + search_parameters.join('&');
}
var new_url = window.location.origin +
window.location.pathname +
new_search +
window.location.hash;
window.history.replaceState({}, "", new_url);
return;
}
}
}
_remove_token_from_url();
</script>
</body>
</html>
REQUEST [debug] REQUEST-RESPONSE--CANCEL-TIMER
REQUEST [debug] -CLEAN-HEADER
REQUEST [debug] -CUT-HEADER
REQUEST [debug] error-thrown = (error http 403)
REQUEST [debug] -PARSE-DATA
REQUEST [debug] parser = ein:notebooklist-login--parser
REQUEST [debug] data = (:bad-page nil)
REQUEST [debug] symbol-status = error
REQUEST [debug] Executing error callback.
REQUEST [debug] REQUEST
REQUEST [debug] Run: curl --silent --include --location --compressed --cookie /Users/ebanner/sandbox/request/curl-cookie-jar --cookie-jar /Users/ebanner/sandbox/request/curl-cookie-jar --write-out \n(:num-redirects %{num_redirects} :url-effective "%{url_effective}") --data-binary @/var/folders/tj/rvw6dyl51fgbh1lr0jqqm33m0000gn/T/emacs-request84111qx0 --request POST http://127.0.0.1:8888/login
ein: [info] Failed to login to 8888
REQUEST [debug] REQUEST--CURL-CALLBACK event = finished
REQUEST [debug] REQUEST--CURL-CALLBACK proc = #<process request curl>
REQUEST [debug] REQUEST--CURL-CALLBACK buffer = #<buffer *request curl*>
REQUEST [debug] REQUEST--CURL-CALLBACK symbol-status = nil
REQUEST [debug] REQUEST--CALLBACK
REQUEST [debug] (buffer-string) =
HTTP/1.1 403 Forbidden
Server: TornadoServer/4.5.1
Content-Type: text/html
Date: Sun, 14 Jan 2018 00:51:20 GMT
Content-Security-Policy: frame-ancestors 'self'; report-uri /api/security/csp-report
Content-Length: 5907
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>Jupyter Notebook</title>
<link rel="shortcut icon" type="image/x-icon" href="/static/base/images/favicon.ico?v=97c6417ed01bdc0ae3ef32ae4894fd03">
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<link rel="stylesheet" href="/static/components/jquery-ui/themes/smoothness/jquery-ui.min.css?v=9b2c8d3489227115310662a343fce11c" type="text/css" />
<link rel="stylesheet" href="/static/components/jquery-typeahead/dist/jquery.typeahead.min.css?v=7afb461de36accb1aa133a1710f5bc56" type="text/css" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="/static/style/style.min.css?v=29c09309dd70e7fe93378815e5f022ae" type="text/css"/>
<style type="text/css">
/* disable initial hide */
div#header, div#site {
display: block;
}
</style>
<link rel="stylesheet" href="/custom/custom.css" type="text/css" />
<script src="/static/components/es6-promise/promise.min.js?v=f004a16cb856e0ff11781d01ec5ca8fe" type="text/javascript" charset="utf-8"></script>
<script src="/static/components/preact/index.js?v=5b98fce8b86ce059de89f9e728e16957" type="text/javascript"></script>
<script src="/static/components/proptypes/index.js?v=c40890eb04df9811fcc4d47e53a29604" type="text/javascript"></script>
<script src="/static/components/preact-compat/index.js?v=d376eb109a00b9b2e8c0d30782eb6df7" type="text/javascript"></script>
<script src="/static/components/requirejs/require.js?v=6da8be361b9ee26c5e721e76c6d4afce" type="text/javascript" charset="utf-8"></script>
<script>
require.config({
urlArgs: "v=20180113165016",
baseUrl: '/static/',
paths: {
'auth/js/main': 'auth/js/main.min',
custom : '/custom',
nbextensions : '/nbextensions',
kernelspecs : '/kernelspecs',
underscore : 'components/underscore/underscore-min',
backbone : 'components/backbone/backbone-min',
jquery: 'components/jquery/jquery.min',
bootstrap: 'components/bootstrap/js/bootstrap.min',
bootstraptour: 'components/bootstrap-tour/build/js/bootstrap-tour.min',
'jquery-ui': 'components/jquery-ui/ui/minified/jquery-ui.min',
moment: 'components/moment/moment',
codemirror: 'components/codemirror',
termjs: 'components/xterm.js/dist/xterm',
typeahead: 'components/jquery-typeahead/dist/jquery.typeahead.min',
},
map: { // for backward compatibility
"*": {
"jqueryui": "jquery-ui",
}
},
shim: {
typeahead: {
deps: ["jquery"],
exports: "typeahead"
},
underscore: {
exports: '_'
},
backbone: {
deps: ["underscore", "jquery"],
exports: "Backbone"
},
bootstrap: {
deps: ["jquery"],
exports: "bootstrap"
},
bootstraptour: {
deps: ["bootstrap"],
exports: "Tour"
},
"jquery-ui": {
deps: ["jquery"],
exports: "$"
}
},
waitSeconds: 30,
});
require.config({
map: {
'*':{
'contents': 'services/contents',
}
}
});
// error-catching custom.js shim.
define("custom", function (require, exports, module) {
try {
var custom = require('custom/custom');
console.debug('loaded custom.js');
return custom;
} catch (e) {
console.error("error loading custom.js", e);
return {};
}
})
</script>
</head>
<body class=""
data-jupyter-api-token="d51a3c533a6b720ea73d826dfb0c238c8614fcd1f90e8059"
dir="ltr">
<noscript>
<div id='noscript'>
Jupyter Notebook requires JavaScript.<br>
Please enable it to proceed.
</div>
</noscript>
<div id="header">
<div id="header-container" class="container">
<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>
</div>
<div class="header-bar"></div>
</div>
<div id="site">
<div class="error">
<h1>403 : Forbidden</h1>
<p>The error was:</p>
<div class="traceback-wrapper">
<pre class="traceback">'_xsrf' argument missing from POST</pre>
</div>
</header>
</div>
<script type='text/javascript'>
require(['jquery'], function($) {
// scroll long tracebacks to the bottom
var tb = $(".traceback")[0];
tb.scrollTop = tb.scrollHeight;
});
</script>
<script type='text/javascript'>
function _remove_token_from_url() {
if (window.location.search.length <= 1) {
return;
}
var search_parameters = window.location.search.slice(1).split('&');
for (var i = 0; i < search_parameters.length; i++) {
if (search_parameters[i].split('=')[0] === 'token') {
// remote token from search parameters
search_parameters.splice(i, 1);
var new_search = '';
if (search_parameters.length) {
new_search = '?' + search_parameters.join('&');
}
var new_url = window.location.origin +
window.location.pathname +
new_search +
window.location.hash;
window.history.replaceState({}, "", new_url);
return;
}
}
}
_remove_token_from_url();
</script>
</body>
</html>
REQUEST [debug] REQUEST-RESPONSE--CANCEL-TIMER
REQUEST [debug] -CLEAN-HEADER
REQUEST [debug] -CUT-HEADER
REQUEST [debug] error-thrown = (error http 403)
REQUEST [debug] -PARSE-DATA
REQUEST [debug] parser = ein:notebooklist-login--parser
REQUEST [debug] data = (:bad-page nil)
REQUEST [debug] symbol-status = error
REQUEST [debug] Executing error callback.
ein: [info] Failed to login to 8888
You can run the command ‘ein:notebooklist-login’ with M-x ein:n-lo RET
ein: [info] Failed to login to 8888
Mark set
and here is the output in the spacemacs instance:
REQUEST [debug] REQUEST
REQUEST [debug] Run: curl --silent --include --location --compressed --cookie /Users/ebanner/spacemacs/.emacs.d/request/curl-cookie-jar --cookie-jar /Users/ebanner/spacemacs/.emacs.d/request/curl-cookie-jar --write-out \n(:num-redirects %{num_redirects} :url-effective "%{url_effective}") --data-binary @/var/folders/tj/rvw6dyl51fgbh1lr0jqqm33m0000gn/T/emacs-request84935DjG --request POST http://127.0.0.1:8888/login
REQUEST [debug] REQUEST--CURL-CALLBACK event = finished
REQUEST [debug] REQUEST--CURL-CALLBACK proc = #<process request curl>
REQUEST [debug] REQUEST--CURL-CALLBACK buffer = #<buffer *request curl*>
REQUEST [debug] REQUEST--CURL-CALLBACK symbol-status = nil
REQUEST [debug] REQUEST--CALLBACK
REQUEST [debug] (buffer-string) =
HTTP/1.1 403 Forbidden
Server: TornadoServer/4.5.1
Content-Type: text/html
Date: Sun, 14 Jan 2018 00:56:07 GMT
Content-Security-Policy: frame-ancestors 'self'; report-uri /api/security/csp-report
Content-Length: 5826
Set-Cookie: _xsrf=2|772a3be8|720cfd1b44773ded1a31d7ff6c132b56|1515891367; Path=/
Set-Cookie: username-127-0-0-1-8888=""; expires=Sat, 14 Jan 2017 00:56:07 GMT; Path=/
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>Jupyter Notebook</title>
<link rel="shortcut icon" type="image/x-icon" href="/static/base/images/favicon.ico?v=97c6417ed01bdc0ae3ef32ae4894fd03">
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<link rel="stylesheet" href="/static/components/jquery-ui/themes/smoothness/jquery-ui.min.css?v=9b2c8d3489227115310662a343fce11c" type="text/css" />
<link rel="stylesheet" href="/static/components/jquery-typeahead/dist/jquery.typeahead.min.css?v=7afb461de36accb1aa133a1710f5bc56" type="text/css" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="/static/style/style.min.css?v=29c09309dd70e7fe93378815e5f022ae" type="text/css"/>
<style type="text/css">
/* disable initial hide */
div#header, div#site {
display: block;
}
</style>
<link rel="stylesheet" href="/custom/custom.css" type="text/css" />
<script src="/static/components/es6-promise/promise.min.js?v=f004a16cb856e0ff11781d01ec5ca8fe" type="text/javascript" charset="utf-8"></script>
<script src="/static/components/preact/index.js?v=5b98fce8b86ce059de89f9e728e16957" type="text/javascript"></script>
<script src="/static/components/proptypes/index.js?v=c40890eb04df9811fcc4d47e53a29604" type="text/javascript"></script>
<script src="/static/components/preact-compat/index.js?v=d376eb109a00b9b2e8c0d30782eb6df7" type="text/javascript"></script>
<script src="/static/components/requirejs/require.js?v=6da8be361b9ee26c5e721e76c6d4afce" type="text/javascript" charset="utf-8"></script>
<script>
require.config({
urlArgs: "v=20180113165230",
baseUrl: '/static/',
paths: {
'auth/js/main': 'auth/js/main.min',
custom : '/custom',
nbextensions : '/nbextensions',
kernelspecs : '/kernelspecs',
underscore : 'components/underscore/underscore-min',
backbone : 'components/backbone/backbone-min',
jquery: 'components/jquery/jquery.min',
bootstrap: 'components/bootstrap/js/bootstrap.min',
bootstraptour: 'components/bootstrap-tour/build/js/bootstrap-tour.min',
'jquery-ui': 'components/jquery-ui/ui/minified/jquery-ui.min',
moment: 'components/moment/moment',
codemirror: 'components/codemirror',
termjs: 'components/xterm.js/dist/xterm',
typeahead: 'components/jquery-typeahead/dist/jquery.typeahead.min',
},
map: { // for backward compatibility
"*": {
"jqueryui": "jquery-ui",
}
},
shim: {
typeahead: {
deps: ["jquery"],
exports: "typeahead"
},
underscore: {
exports: '_'
},
backbone: {
deps: ["underscore", "jquery"],
exports: "Backbone"
},
bootstrap: {
deps: ["jquery"],
exports: "bootstrap"
},
bootstraptour: {
deps: ["bootstrap"],
exports: "Tour"
},
"jquery-ui": {
deps: ["jquery"],
exports: "$"
}
},
waitSeconds: 30,
});
require.config({
map: {
'*':{
'contents': 'services/contents',
}
}
});
// error-catching custom.js shim.
define("custom", function (require, exports, module) {
try {
var custom = require('custom/custom');
console.debug('loaded custom.js');
return custom;
} catch (e) {
console.error("error loading custom.js", e);
return {};
}
})
</script>
</head>
<body class=""
dir="ltr">
<noscript>
<div id='noscript'>
Jupyter Notebook requires JavaScript.<br>
Please enable it to proceed.
</div>
</noscript>
<div id="header">
<div id="header-container" class="container">
<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>
</div>
<div class="header-bar"></div>
</div>
<div id="site">
<div class="error">
<h1>403 : Forbidden</h1>
<p>The error was:</p>
<div class="traceback-wrapper">
<pre class="traceback">'_xsrf' argument missing from POST</pre>
</div>
</header>
</div>
<script type='text/javascript'>
require(['jquery'], function($) {
// scroll long tracebacks to the bottom
var tb = $(".traceback")[0];
tb.scrollTop = tb.scrollHeight;
});
</script>
<script type='text/javascript'>
function _remove_token_from_url() {
if (window.location.search.length <= 1) {
return;
}
var search_parameters = window.location.search.slice(1).split('&');
for (var i = 0; i < search_parameters.length; i++) {
if (search_parameters[i].split('=')[0] === 'token') {
// remote token from search parameters
search_parameters.splice(i, 1);
var new_search = '';
if (search_parameters.length) {
new_search = '?' + search_parameters.join('&');
}
var new_url = window.location.origin +
window.location.pathname +
new_search +
window.location.hash;
window.history.replaceState({}, "", new_url);
return;
}
}
}
_remove_token_from_url();
</script>
</body>
</html>
REQUEST [debug] REQUEST-RESPONSE--CANCEL-TIMER
REQUEST [debug] -CLEAN-HEADER
REQUEST [debug] -CUT-HEADER
REQUEST [debug] error-thrown = (error http 403)
REQUEST [debug] -PARSE-DATA
REQUEST [debug] parser = ein:notebooklist-login--parser
REQUEST [debug] data = (:bad-page nil)
REQUEST [debug] symbol-status = error
REQUEST [debug] Executing error callback.
REQUEST [debug] REQUEST
REQUEST [debug] Run: curl --silent --include --location --compressed --cookie /Users/ebanner/spacemacs/.emacs.d/request/curl-cookie-jar --cookie-jar /Users/ebanner/spacemacs/.emacs.d/request/curl-cookie-jar --write-out \n(:num-redirects %{num_redirects} :url-effective "%{url_effective}") --data-binary @/var/folders/tj/rvw6dyl51fgbh1lr0jqqm33m0000gn/T/emacs-request84935QtM --request POST --header X-XSRFTOKEN: 2|772a3be8|720cfd1b44773ded1a31d7ff6c132b56|1515891367 http://127.0.0.1:8888/login
ein: [info] Failed to login to 8888
REQUEST [debug] REQUEST--CURL-CALLBACK event = finished
REQUEST [debug] REQUEST--CURL-CALLBACK proc = #<process request curl>
REQUEST [debug] REQUEST--CURL-CALLBACK buffer = #<buffer *request curl*>
REQUEST [debug] REQUEST--CURL-CALLBACK symbol-status = nil
REQUEST [debug] -CLEAN-HEADER
REQUEST [debug] -CUT-HEADER
REQUEST [debug] REQUEST--CALLBACK
REQUEST [debug] (buffer-string) =
HTTP/1.1 405 Method Not Allowed
Server: TornadoServer/4.5.1
Content-Type: text/html; charset=UTF-8
Date: Sun, 14 Jan 2018 00:56:07 GMT
Content-Length: 87
<html><title>405: Method Not Allowed</title><body>405: Method Not Allowed</body></html>
REQUEST [debug] REQUEST-RESPONSE--CANCEL-TIMER
REQUEST [debug] -CLEAN-HEADER
REQUEST [debug] -CUT-HEADER
REQUEST [debug] error-thrown = (error http 405)
REQUEST [debug] -PARSE-DATA
REQUEST [debug] parser = ein:notebooklist-login--parser
REQUEST [debug] data = (:bad-page nil)
REQUEST [debug] symbol-status = error
REQUEST [debug] Executing error callback.
ein: [info] Login to 8888 complete. Now you can open notebook list by `ein:notebooklist-open'.
You can run the command ‘ein:notebooklist-login’ with M-x ein:n-lo RET
ein: [info] Login to 8888 complete. Now you can open notebook list by `ein:notebooklist-open'.
One difference I see is that in the MELPA case the curl-cookie-jar
file (i.e. /Users/ebanner/sandbox/request/curl-cookie-jar
) does not exist whereas in the spacemacs case the /Users/ebanner/spacemacs/.emacs.d/request/curl-cookie-jar
contains the following contents:
# Netscape HTTP Cookie File
# http://curl.haxx.se/docs/http-cookies.html
# This file was generated by libcurl! Edit at your own risk.
127.0.0.1 FALSE / FALSE 0 _xsrf 2|772a3be8|720cfd1b44773ded1a31d7ff6c132b56|1515891367
#HttpOnly_127.0.0.1 FALSE / FALSE 1518483367 username-127-0-0-1-8888 "2|1:0|10:1515891367|23:username-127-0-0-1-8888|44:YWNmOWZhOTIzYWJkNDRjYTgwZjc4ODc0MWFkMGQ1YTQ=|eea32c1033a84131bbf21079b60224b995270840aa7422d16ca0027d69e0b389"
Also in the two instances send different headers. The MELPA header does not have any cookie information whereas the spacemacs instance has the following:
Set-Cookie: _xsrf=2|772a3be8|720cfd1b44773ded1a31d7ff6c132b56|1515891367; Path=/
Set-Cookie: username-127-0-0-1-8888=""; expires=Sat, 14 Jan 2017 00:56:07 GMT; Path=/
The MELPA instance has the following line in the <body>
tag:
data-jupyter-api-token="d51a3c533a6b720ea73d826dfb0c238c8614fcd1f90e8059"
whereas the spacemacs instance does not.
The MELPA instance encounters a HTTP/1.1 403 Forbidden
whereas the spacemacs version encounters a 405: Method Not Allowed
.
Ah I think I've gotten to the bottom of it! It's all an issue with resolving the path to the curl-cookie-jar
file that gets created in the curl
call.
It turns out that MELPA's sandbox Makefile uses a relative path to reference the sandbox/
directory (i.e. ./sandbox
) which is what user-emacs-directory
gets set to. This causes the function request--curl-cookie-jar
(and then by consequence the request--curl
function) to get confused as to where sandbox/
is.
Here is part of the curl
command that request--url
generates:
curl --cookie /Users/ebanner/sandbox/request/curl-cookie-jar --cookie-jar /Users/ebanner/sandbox/request/curl-cookie-jar
Notice the path /Users/ebanner/sandbox/request/curl-cookie-jar
is provided. It should be /Users/ebanner/Documents/melpa/sandbox/request/curl-cookie-jar
as I ran the make sandbox
command from the /Users/ebanner/Documents/melpa
directory!
I also threw some print statements into request.el
in the request--curl-cookie-jar
function to further illustrate what is going on:
(defun request--curl-cookie-jar ()
"Cookie storage for curl backend."
(message "request--curl-cookie-jar = %s" request--curl-cookie-jar)
(message "request-storage-directory = %s" request-storage-directory)
(message "expanded-file-name = %s" (expand-file-name "curl-cookie-jar" request-storage-directory))
(or request--curl-cookie-jar
(expand-file-name "curl-cookie-jar" request-storage-directory)))
and caused M-x ein:notebooklist-login RET 8888 RET <password> RET
to print out
request--curl-cookie-jar = nil
request-storage-directory = ./sandbox/request
expanded-file-name = /Users/ebanner/Documents/melpa/sandbox/request/curl-cookie-jar
REQUEST [debug] REQUEST
request--curl-cookie-jar = nil
request-storage-directory = ./sandbox/request
expanded-file-name = /Users/ebanner/Documents/melpa/sandbox/request/curl-cookie-jar
request--curl-cookie-jar = nil
request-storage-directory = ./sandbox/request
expanded-file-name = /Users/ebanner/sandbox/request/curl-cookie-jar
Notice sometimes expanded-file-name
is correctly set to /Users/ebanner/Documents/melpa/sandbox/request/curl-cookie-jar
but sometimes it's incorrectly set to /Users/ebanner/sandbox/request/curl-cookie-jar
. I have no idea why it would produce different values with the same input arguments.
The workaround is to pass an absolute path to make sandbox
i.e.
$ rm -rf sandbox && make sandbox INSTALL=pynt SANDBOX=$PWD/sandbox
Running M-x ein:notebooklist-login RET 8888 RET <password> RET
one more time result in the following:
request--curl-cookie-jar = nil
request-storage-directory = /Users/ebanner/Documents/melpa/sandbox/request
expand-file-name = /Users/ebanner/Documents/melpa/sandbox/request/curl-cookie-jar
request--curl-cookie-jar = nil
request-storage-directory = /Users/ebanner/Documents/melpa/sandbox/request
expand-file-name = /Users/ebanner/Documents/melpa/sandbox/request/curl-cookie-jar
request--curl-cookie-jar = nil
request-storage-directory = /Users/ebanner/Documents/melpa/sandbox/request
expand-file-name = /Users/ebanner/Documents/melpa/sandbox/request/curl-cookie-jar
request--curl-cookie-jar = nil
request-storage-directory = /Users/ebanner/Documents/melpa/sandbox/request
expand-file-name = /Users/ebanner/Documents/melpa/sandbox/request/curl-cookie-jar
request--curl-cookie-jar = nil
request-storage-directory = /Users/ebanner/Documents/melpa/sandbox/request
expand-file-name = /Users/ebanner/Documents/melpa/sandbox/request/curl-cookie-jar
request--curl-cookie-jar = nil
request-storage-directory = /Users/ebanner/Documents/melpa/sandbox/request
expand-file-name = /Users/ebanner/Documents/melpa/sandbox/request/curl-cookie-jar
ein: [info] Failed to login to 8888
ein: [info] Login to 8888 complete. Now you can open notebook list by `ein:notebooklist-open'.
You can run the command ‘ein:notebooklist-login’ with M-x ein:n-lo RET
ein: [info] Login to 8888 complete. Now you can open notebook list by `ein:notebooklist-open'.
Notice expanded-file-name
is correctly set every time and the login command (eventually) succeeds!
I can't tell if this is a bug in MELPA or requests or expand-file-name
. It all stems from the setting of the emacs-user-directory
variable and whether a relative or absolute path is used.
I did a M-x trace-function RET expand-file-name RET
and then a M-x ein:notebooklist-login RET 8888 RET <password> RET
and here's what it outputted:
======================================================================
1 -> (expand-file-name "curl-cookie-jar" "./sandbox/request")
1 <- expand-file-name: "/Users/ebanner/Documents/melpa/sandbox/request/curl-cookie-jar"
======================================================================
1 -> (expand-file-name "curl-cookie-jar" "./sandbox/request")
1 <- expand-file-name: "/Users/ebanner/Documents/melpa/sandbox/request/curl-cookie-jar"
======================================================================
1 -> (expand-file-name "/Users/ebanner/Documents/melpa/sandbox/request/")
1 <- expand-file-name: "/Users/ebanner/Documents/melpa/sandbox/request/"
======================================================================
1 -> (expand-file-name "/Users/ebanner/Documents/melpa/sandbox/request/")
1 <- expand-file-name: "/Users/ebanner/Documents/melpa/sandbox/request/"
======================================================================
1 -> (expand-file-name "~/")
1 <- expand-file-name: "/Users/ebanner/"
======================================================================
1 -> (expand-file-name "curl-cookie-jar" "./sandbox/request")
1 <- expand-file-name: "/Users/ebanner/sandbox/request/curl-cookie-jar"
======================================================================
1 -> (expand-file-name "/Users/ebanner/sandbox/request/curl-cookie-jar")
1 <- expand-file-name: "/Users/ebanner/sandbox/request/curl-cookie-jar"
======================================================================
1 -> (expand-file-name "emacs-request" "/var/folders/tj/rvw6dyl51fgbh1lr0jqqm33m0000gn/T/")
1 <- expand-file-name: "/var/folders/tj/rvw6dyl51fgbh1lr0jqqm33m0000gn/T/emacs-request"
======================================================================
1 -> (expand-file-name "curl-cookie-jar" "./sandbox/request")
1 <- expand-file-name: "/Users/ebanner/Documents/melpa/sandbox/request/curl-cookie-jar"
======================================================================
1 -> (expand-file-name "curl-cookie-jar" "./sandbox/request")
1 <- expand-file-name: "/Users/ebanner/Documents/melpa/sandbox/request/curl-cookie-jar"
======================================================================
1 -> (expand-file-name "/Users/ebanner/Documents/melpa/sandbox/request/")
1 <- expand-file-name: "/Users/ebanner/Documents/melpa/sandbox/request/"
======================================================================
1 -> (expand-file-name "/Users/ebanner/Documents/melpa/sandbox/request/")
1 <- expand-file-name: "/Users/ebanner/Documents/melpa/sandbox/request/"
======================================================================
1 -> (expand-file-name "~/")
1 <- expand-file-name: "/Users/ebanner/"
======================================================================
1 -> (expand-file-name "curl-cookie-jar" "./sandbox/request")
1 <- expand-file-name: "/Users/ebanner/sandbox/request/curl-cookie-jar"
======================================================================
1 -> (expand-file-name "/Users/ebanner/sandbox/request/curl-cookie-jar")
1 <- expand-file-name: "/Users/ebanner/sandbox/request/curl-cookie-jar"
Notice sometimes (expand-file-name "curl-cookie-jar" "./sandbox/request")
becomes "/Users/ebanner/Documents/melpa/sandbox/request/curl-cookie-jar"
and sometimes it becomes "/Users/ebanner/sandbox/request/curl-cookie-jar"
!
Could it be that expand-file-name
gets run from different directories (i.e. sometimes it gets run from /Users/ebanner
and sometimes from /Users/ebanner/Documents/melpa
?
This is some truly impressive detective work. Seems like your particular issue may be fixed, but I should probably still see if ein is doing anything unexpected with the default-directory
variable.
Thanks for the report.
@millejoh I continued discussion of this issue in this melpa issue. The ultimate "fix" that was accepted was running user-emacs-directory
through the function file-truename
.
You can read in this comment that the setting of default-directory
is the same in the case of a ein:jupyter-server-start
error and also on a ein:jupyter-server-start
success. Hence default-directory
not causing the issue (to my best estimation).
I don't know what _xsrf
does, but I was able to sidestep this entire thing by adding a line to my jupyter config (~/.jupyter/jupyter_notebook_config.py
) per this link:
c.NotebookApp.disable_check_xsrf = True
. FYI, token authentication is disabled on my jupyter notebooks.
Before I did this, I was just not able to get a kernel started. EIN kept saying kernel not ready
.
I know there have been a couple of issues related to xsrf argument. But here I am trying to use EIN to connect to Jupyter notebook running in a remote server that I have ssh access to. I can't seem to login using Ein.
Here is my workflow. In the remote server, I open a notebook by
$ jupyter-notebook --port=7000
Then using the local machine, I tried to login.
M-x ein:notebooklist-login
. On the server side, I get the following messages.[W 16:15:45.147 NotebookApp] 403 POST /login (18.189.49.190): '_xsrf' argument missing from POST [W 16:15:45.169 NotebookApp] 403 POST /login (18.189.49.190) 22.06ms referer=None [W 16:15:46.553 NotebookApp] 403 POST /login (18.189.49.190): '_xsrf' argument missing from POST [W 16:15:46.554 NotebookApp] 403 POST /login (18.189.49.190) 1.63ms referer=None
For my setup,
request-backend = curl
,My curl-cookie-jar file is
By the way, I am able to use my browser to use the notebook.