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 recent call last):
File "<input>", line 1, in ?
File "C:\Python24\lib\urllib.py", line 77, in urlopen
return opener.open(url)
File "C:\Python24\lib\urllib.py", line 180, in open
return getattr(self, name)(url)
File "C:\Python24\lib\urllib.py", line 296, in open_http
h.endheaders()
File "C:\Python24\lib\httplib.py", line 794, in endheaders
self._send_output()
File "C:\Python24\lib\httplib.py", line 675, in _send_output
self.send(msg)
File "C:\Python24\lib\httplib.py", line 642, in send
self.connect()
File "C:\Python24\lib\httplib.py", line 610, in connect
socket.SOCK_STREAM):
IOError: [Errno socket error] (11001, 'getaddrinfo failed')
Any ideas on what i did wrong? 6 14506
JabaPyth wrote: 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 recent call last): File "<input>", line 1, in ? File "C:\Python24\lib\urllib.py", line 77, in urlopen return opener.open(url) File "C:\Python24\lib\urllib.py", line 180, in open return getattr(self, name)(url) File "C:\Python24\lib\urllib.py", line 296, in open_http h.endheaders() File "C:\Python24\lib\httplib.py", line 794, in endheaders self._send_output() File "C:\Python24\lib\httplib.py", line 675, in _send_output self.send(msg) File "C:\Python24\lib\httplib.py", line 642, in send self.connect() File "C:\Python24\lib\httplib.py", line 610, in connect socket.SOCK_STREAM): IOError: [Errno socket error] (11001, 'getaddrinfo failed')
Any ideas on what i did wrong?
Works for me, do you have a proxy or some strange setup for accessing to
the web?
Try using the urllib2 module, too.
I tried using urllib2 and this is what i got: import urllib2 the_url = 'http://www.google.com' req = urllib2.Request(the_url) handle = urllib2.urlopen(req)
Traceback (most recent call last):
File "<input>", line 1, in ?
File "C:\Python24\lib\urllib2.py", line 130, in urlopen
return _opener.open(url, data)
File "C:\Python24\lib\urllib2.py", line 358, in open
response = self._open(req, data)
File "C:\Python24\lib\urllib2.py", line 376, in _open
'_open', req)
File "C:\Python24\lib\urllib2.py", line 337, in _call_chain
result = func(*args)
File "C:\Python24\lib\urllib2.py", line 1021, in http_open
return self.do_open(httplib.HTTPConnection, req)
File "C:\Python24\lib\urllib2.py", line 996, in do_open
raise URLError(err)
URLError: <urlopen error (11001, 'getaddrinfo failed')>
Easy Fix...
import urllib
the_url = "http://www.google.com"
req = urllib.urlopen(the_url)
Does this work for you??
Jay wrote: Easy Fix...
import urllib the_url = "http://www.google.com" req = urllib.urlopen(the_url)
Does this work for you??
This does look like proxie /firewall issue, try it from an internet
cafe. Also depending on the site, you may have to set User-Agnet
and/or referer headers. And definitely respect robots.txt, throttle
back requests to seom finite (human-scale) volume and save them to your
hard drive (mistakes i've made)
Thanks, guys.
I tried on a different computer, and it worked fine.I then found out
that my computer thyought i had a proxy server, and after i cleaned
that up, it worked.
Thanks again
On Sat, 17 Dec 2005, Dennis Lee Bieber wrote: (Now there is an interesting technical term: #define ERROR_ARENA_TRASHED 7)
FreeBSD at one point had an EDOOFUS; Apple kvetched about this being
offensive, so it was changed to EDONTPANIC.
I shitteth thee not.
tom
--
information distribution, vox humana, deviation, handle, feed, l.g. ** This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
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 ...
...
|
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...
|
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...
|
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...
|
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...
| |
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...
|
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:
|
by: John Nagle |
last post by:
If you try to open a password protected page with "urllib.urlopen()", you get
"Enter username for EnterPassword at example.com:"
on standard output, followed by a read for input! This seems to...
|
by: gmguyx |
last post by:
I tried using urllib.urlopen to open a personalized webpage
(my.yahoo.com) but it doesn't work:
print urllib.urlopen(http://my.yahoo.com).read()
Instead of returning my.yahoo.com, it returns a...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |