urllib.urlopen fails in Emacs

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Iain Dalton

    urllib.urlopen fails in Emacs

    In Emacs, using run-python,

    import urllib
    urllib.urlopen( 'http://www.google.com/')

    results in this traceback:

    Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
    File "/usr/lib/python2.5/urllib.py", line 82, in urlopen
    return opener.open(url )
    File "/usr/lib/python2.5/urllib.py", line 190, in open
    return getattr(self, name)(url)
    File "/usr/lib/python2.5/urllib.py", line 325, in open_http
    h.endheaders()
    File "/usr/lib/python2.5/httplib.py", line 860, in endheaders
    self._send_outp ut()
    File "/usr/lib/python2.5/httplib.py", line 732, in _send_output
    self.send(msg)
    File "/usr/lib/python2.5/httplib.py", line 699, in send
    self.connect()
    File "/usr/lib/python2.5/httplib.py", line 683, in connect
    raise socket.error, msg
    IOError: [Errno socket error] (111, 'Connection refused')

    It works fine from the command line. Why is this happening?
  • Wojtek Walczak

    #2
    Re: urllib.urlopen fails in Emacs

    On Fri, 26 Sep 2008 02:23:18 -0600, Iain Dalton wrote:
    In Emacs, using run-python,
    >
    import urllib
    urllib.urlopen( 'http://www.google.com/')
    >
    results in this traceback:
    ....
    IOError: [Errno socket error] (111, 'Connection refused')
    >
    It works fine from the command line. Why is this happening?
    I can't answer your question, since I don't use emacs,
    but it looks like emacs has some kind of built in firewall.

    ;-)

    --
    Regards,
    Wojtek Walczak,
    Cena domeny: 4999 PLN (do negocjacji). Możliwość kupna na raty od 624.88 PLN miesięcznie. Oferta sprzedaży znajduje się w serwisie Aftermarket.pl, największej giełdzie domen internetowych w Polsce.

    Comment

    • Niklas Norrthon

      #3
      Re: urllib.urlopen fails in Emacs

      On 26 Sep, 12:21, Wojtek Walczak <gmin...@bzt.bz twrote:
      On Fri, 26 Sep 2008 02:23:18 -0600, Iain Dalton wrote:
      InEmacs, using run-python,
      >
          import urllib
         urllib.urlopen( 'http://www.google.com/')
      >
      results in this traceback:
      ...
          IOError: [Errno socket error] (111, 'Connection refused')
      >
      It works fine from the command line.  Why is this happening?
      >
      I can't answer your question, since I don't useemacs,
      but it looks likeemacshas some kind of built in firewall.
      >
      ;-)
      >
      --
      Regards,
      Wojtek Walczak,http://tosh.pl/gminick/
      I don't think it is emacs... It works for me, using emacs 22.1, python
      2.5.1, and windows XP:

      Python 2.5.1 (r251:54863, Apr 18 2007, 08:51:08) [MSC v.1310 32 bit
      (Intel)] on win32
      Type "help", "copyright" , "credits" or "license" for more information.
      >>import urllib
      >>urllib.urlope n('http://www.google.com/')
      <addinfourl at 12530592 whose fp = <socket._fileob ject object at
      0x00BF4030>>
      >>>
      /Niklas Norrthon

      Comment

      Working...