472,777 Members | 2,611 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,777 software developers and data experts.

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_output()
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?
Sep 26 '08 #1
2 1826
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,
http://tosh.pl/gminick/
Sep 26 '08 #2
On 26 Sep, 12:21, Wojtek Walczak <gmin...@bzt.bztwrote:
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.urlopen('http://www.google.com/')
<addinfourl at 12530592 whose fp = <socket._fileobject object at
0x00BF4030>>
>>>
/Niklas Norrthon
Sep 26 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Richard Shea | last post by:
Hi - I'm new to Python. I've been trying to use URLLIB and the 'tidy' function (part of the mx.tidy package). There's one thing I'm having real difficulties understanding. When I did this ... ...
11
by: Pater Maximus | last post by:
I am trying to implement the recipe listed at http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/211886 However, I can not get to first base. When I try to run import urllib...
0
by: Pieter Edelman | last post by:
Hi all, I'm trying to submit some data using a POST request to a HTTP server with BASIC authentication with python, but I can't get it to work. Since it's driving me completely nuts, so here's...
1
by: Timothy Wu | last post by:
Hi, I'm trying to fill the form on page http://www.cbs.dtu.dk/services/TMHMM/ using urllib. There are two peculiarities. First of all, I am filling in incorrect key/value pairs in the...
4
by: william | last post by:
I've got a strange problem on windows (not very familiar with that OS). I can ping a host, but cannot get it via urllib (see here under). I can even telnet the host on port 80. Thus network...
6
by: JabaPyth | last post by:
Hello, I'm trying to use the urllib module, but when i try urllib.urlopen, it gives me a socket error: >>import urllib >>print urllib.urlopen('http://www.google.com/').read() Traceback (most...
0
by: Ali.Sabil | last post by:
hello all, I just maybe hit a bug in both urllib and urllib2, actually urllib doesn't support proxy authentication, and if you setup the http_proxy env var to...
4
by: kgrafals | last post by:
Hi, I'm just trying to read from a webpage with urllib but I'm getting IOErrors. This is my code: import urllib sock = urllib.urlopen("http://www.google.com/") and this is the error:
1
by: Edwin.Madari | last post by:
jlist wrote: switching to urllib2, installing the proxy opener, worked for me. here is the sample. variable names are self explanatory import urllib2...
0
by: Rina0 | last post by:
Cybersecurity engineering is a specialized field that focuses on the design, development, and implementation of systems, processes, and technologies that protect against cyber threats and...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 2 August 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: kcodez | last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
14
DJRhino1175
by: DJRhino1175 | last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this - If...
0
by: Rina0 | last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
5
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: Mushico | last post by:
How to calculate date of retirement from date of birth
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.