gregsexton / ob-ipython

org-babel integration with Jupyter for evaluation of (Python by default) code blocks
739 stars 109 forks source link

Invalid argument 3 of operation #147

Closed isaaczhou closed 6 years ago

isaaczhou commented 6 years ago

Hi try to run it within the ubuntu subsystem on windows 10, got the following error. Looks like it's an lisp error. Any suggestion where it might go wrong? Thanks.

Debugger entered--Lisp error: (error "Invalid argument 3 of operation `call-process-region'")call-process-region("my_list = [1,2,3,4,5]\nmy_list" nil nil nil t nil "--" "/home/isaac/.emacs.d/elpa/ob-ipython-20171203.126/client.py" "--conn-file" "no$apply(call-process-region "my_list = [1,2,3,4,5]\nmy_list" nil nil nil t nil ("--" "/home/isaac/.emacs.d/elpa/ob-ipython-20171203.126/client.py" "--conn-fi$ob-ipython--execute-request("my_list = [1,2,3,4,5]\nmy_list" "none")ob-ipython--execute-sync("my_list = [1,2,3,4,5]\nmy_list" ((:colname-names) (:rowname-names) (:result-params "replace") (:result-type . value) (:results . $org-babel-execute:ipython("my_list = [1,2,3,4,5]\nmy_list" ((:colname-names) (:rowname-names) (:result-params "replace") (:result-type . value) (:results .$org-babel-execute-src-block(nil ("ipython" "my_list = [1,2,3,4,5]\nmy_list" ((:colname-names) (:rowname-names) (:result-params "replace") (:result-type . v$org-ctrl-c-ctrl-c(nil)call-interactively(org-ctrl-c-ctrl-c nil nil)command-execute(org-ctrl-c-ctrl-c)

tbrantseg commented 6 years ago

I have the same error on the Windows 10 ubuntu subsystem:

Debugger entered--Lisp error: (error "Invalid argument 3 of operation ‘call-process-region’")
  call-process-region("%matplotlib inline\nimport matplotlib.pyplot as mpl\nimport numpy as np\nimport pandas as pd\nimport matplotlib\nmatplotlib.rcParams['text.usetex']=True\nmatplotlib.rcParams['font.family']='serif'\nmatplotlib.rcParams['figure.autolayout']=True" nil nil nil t nil "--" "/home/tom/.emacs.d/elpa/ob-ipython-20180113.929/client.py" "--conn-file" "default" "--execute")
  apply(call-process-region "%matplotlib inline\nimport matplotlib.pyplot as mpl\nimport numpy as np\nimport pandas as pd\nimport matplotlib\nmatplotlib.rcParams['text.usetex']=True\nmatplotlib.rcParams['font.family']='serif'\nmatplotlib.rcParams['figure.autolayout']=True" nil nil nil t nil ("--" "/home/tom/.emacs.d/elpa/ob-ipython-20180113.929/client.py" "--conn-file" "default" "--execute"))
  ob-ipython--execute-request("%matplotlib inline\nimport matplotlib.pyplot as mpl\nimport numpy as np\nimport pandas as pd\nimport matplotlib\nmatplotlib.rcParams['text.usetex']=True\nmatplotlib.rcParams['font.family']='serif'\nmatplotlib.rcParams['figure.autolayout']=True" "default")
  ob-ipython--execute-sync("%matplotlib inline\nimport matplotlib.pyplot as mpl\nimport numpy as np\nimport pandas as pd\nimport matplotlib\nmatplotlib.rcParams['text.usetex']=True\nmatplotlib.rcParams['font.family']='serif'\nmatplotlib.rcParams['figure.autolayout']=True" ((:colname-names) (:rowname-names) (:result-params "silent") (:result-type . value) (:comments . "") (:shebang . "") (:cache . "no") (:padline . "") (:noweb . "no") (:tangle . "no") (:exports . "code") (:results . "silent") (:hlines . "no") (:session)))
  org-babel-execute:ipython("%matplotlib inline\nimport matplotlib.pyplot as mpl\nimport numpy as np\nimport pandas as pd\nimport matplotlib\nmatplotlib.rcParams['text.usetex']=True\nmatplotlib.rcParams['font.family']='serif'\nmatplotlib.rcParams['figure.autolayout']=True" ((:colname-names) (:rowname-names) (:result-params "silent") (:result-type . value) (:comments . "") (:shebang . "") (:cache . "no") (:padline . "") (:noweb . "no") (:tangle . "no") (:exports . "code") (:results . "silent") (:hlines . "no") (:session)))
  org-babel-execute-src-block(nil ("ipython" "%matplotlib inline\nimport matplotlib.pyplot as mpl\nimport numpy as np\nimport pandas as pd\nimport matplotlib\nmatplotlib.rcParams['text.usetex']=True\nmatplotlib.rcParams['font.family']='serif'\nmatplotlib.rcParams['figure.autolayout']=True" ((:comments . "") (:shebang . "") (:cache . "no") (:padline . "") (:noweb . "no") (:tangle . "no") (:exports . "code") (:results . "silent") (:session) (:hlines . "no")) "" "ipython-plot-setup" 0 213) ((:results . "silent")))
  org-babel-ref-resolve("ipython-plot-setup()")
  org-babel-ref-parse("results=ipython-plot-setup()")
  #[(el) "A:\203   A\207\301A!\207" [el org-babel-ref-parse] 2]((:var . "results=ipython-plot-setup()"))
  mapcar(#[(el) "A:\203    A\207\301A!\207" [el org-babel-ref-parse] 2] ((:var . "results=ipython-plot-setup()")))
  org-babel-process-params(((:comments . "") (:shebang . "") (:cache . "no") (:padline . "") (:noweb . "no") (:tangle . "no") (:exports . "code") (:results . "replace") (:var . "results=ipython-plot-setup()") (:colnames . "no") (:hlines . "yes") (:session . "none")))
  org-babel-lob-execute(("ipython-plot-setup()" nil 0 nil))
  org-babel-lob-execute-maybe()
  org-babel-execute-maybe()
  org-babel-execute-safely-maybe()
  run-hook-with-args-until-success(org-babel-execute-safely-maybe)
  org-ctrl-c-ctrl-c(nil)
  funcall-interactively(org-ctrl-c-ctrl-c nil)
  call-interactively(org-ctrl-c-ctrl-c nil nil)
  command-execute(org-ctrl-c-ctrl-c)

From the error above, the text is being sent to nil, not to the jupyter kernel.

I also notice that the ob-ipython-kernel-default buffer displays the jupyter console prompt, which I certainly don't remember from running ob-ipython on Mac.

tbrantseg commented 6 years ago

@isaaczhou What is python-shell-interpreter set to for you? (locate-file python-shell-interpreter exec-path) returned nil for me, and I realized I had an error in my .emacs.