gregsexton / ob-ipython

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

HTTP/1.1 502 Invalid argument #90

Closed deisi closed 8 years ago

deisi commented 8 years ago

Setup:

init.el contains:

(require 'ob-ipython)
(org-babel-do-load-languages
 'org-babel-load-languages
 '((ipython . t)
   (python . t)
   ))
(setq org-src-fontify-natively t
    org-src-preserve-indentation t
    org-src-tab-acts-natively t)

Example Code

#+BEGIN_SRC ipython :session
  %matplotlib inline
  import matplotlib.pyplot as plt
  import numpy as np
#+END_SRC

Error

If I run with C-c C-c I get Fatal Error and the debug log says:

HTTP/1.1 502 Invalid argument
Date: Thu, 20 Oct 2016 11:49:34 GMT
Cache-Control: no-cache
Pragma: no-cache
Content-Type: text/html; charset="UTF-8"
Content-Length: 2528
Accept-Ranges: none
Proxy-Connection: close

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>The requested URL could not be retrieved</title>
    <link href="http://passthrough.fw-notify.net/static/default.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="http://passthrough.fw-notify.net/static/default.js"></script>
  </head>
  <body onload="checkResize();">
    <div id="emsg_large"></div>
    <div id="page">
      <div id="header">
        <div><img src="http://passthrough.fw-notify.net/static/topbar_left.png" width="6" height="72" border="0" /></div>
        <div id="company_logo"><img src="http://passthrough.fw-notify.net/static/logo.png" border="0" /></div>
        <div id="company_text"><h1 class="orange">Sophos UTM Version 9   http://www.sophos.com</h1></div>
        <div><img src="http://passthrough.fw-notify.net/static/topbar_right.png" width="6" height="72" border="0" /></div>
      </div>
      <br class="clearer" />

      <div id="content">
        <img src="http://passthrough.fw-notify.net/static/warning.png" border="0" align="left" />
        <h1 class="orange">An error occurred while handling your request</h1>

        <div class="line">
          <div class="label">While trying to retrieve the URL:</div>
          <div class="desc"> 
            <span>http://localhost:9988/execute/default</span>
          </div>
        </div>

        <div class="line">
          <div class="label">The content could not be delivered due to the following condition:</div>
          <div class="desc"> 
            Invalid argument
          </div>
        </div>

        <div class="line">
          <div class="label">Your cache administrator is:</div>
          <div class="desc"> 
            firewall@mpip-mainz.mpg.de
          </div>
        </div>
        <br class="clearer" />
      </div> <!-- END: div#content -->
      <br class="clearer" />

      <div id="footer">
        <div><a href="http://www.sophos.com" target="_blank" title="Sophos"><img src="http://passthrough.fw-notify.net/static/footer_left.png" width="136" height="33" border="0" /></a></div>
        <div class="orange" id="copyright">Powered by UTM Web Protection</div>
        <div><img src="http://passthrough.fw-notify.net/static/footer_right.png" width="6" height="33" border="0" /></div>
      </div> <!-- END: div#footer -->
    </div> <!-- END: div#page -->
  </body>
</html>

Any suggestions what is wrong?

deisi commented 8 years ago

Okay, I found out what this comes from. It is because, I'm sitting behind a proxy, and one has to expicitly exclue localhost from the proxy in emacs. Not he problem is different though. It now hangs with: Contacting host: localhost:9988

I have turned of the windows firewall just to be shure...

deisi commented 8 years ago

This is how my proxy config looks right now:

(setq url-proxy-services
      '(("no_proxy" . "^\\(localhost\\|10.*\\|*.mpip-mainz.mpg.de\\|127.0.0.1\\)")
         ("http" . "www-proxy.mpip-mainz.mpg.de:8080")
         ("https" . "www-proxy.mpip-mainz.mpg.de:8080")
         ))
gregsexton commented 8 years ago

What was the issue?

deisi commented 8 years ago

A, sorry didn't make it clear. It is solved by now. The issue is/was, that emacs is very picky when behind a proxy. You have to explicitly remove localhost from the proxy list, as you can now see in my answer above. It is important to add: localhost, as well as 127.0.0.1 to the no_proxy field.