473,379 Members | 1,326 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,379 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 1861
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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.