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:
Traceback (most recent call last):
File "<pyshell#5>", line 1, in <module>
sock = urllib.urlopen("http://www.google.com/")
File "C:\Python25\lib\urllib.py", line 82, in urlopen
return opener.open(url)
File "C:\Python25\lib\urllib.py", line 190, in open
return getattr(self, name)(url)
File "C:\Python25\lib\urllib.py", line 325, in open_http
h.endheaders()
File "C:\Python25\lib\httplib.py", line 856, in endheaders
self._send_output()
File "C:\Python25\lib\httplib.py", line 728, in _send_output
self.send(msg)
File "C:\Python25\lib\httplib.py", line 695, in send
self.connect()
File "C:\Python25\lib\httplib.py", line 679, in connect
raise socket.error, msg
IOError: [Errno socket error] (10060, 'Operation timed out')
I'm behind my company's firewall. Would that cause a problem? If it
does, How do I get around it? 4 9302
Hello,
Try to increase the time out : socket.settimeout(n)
and catch the timeout error when it occurs
Regards kg******@gmail.com a écrit :
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:
Traceback (most recent call last):
File "<pyshell#5>", line 1, in <module>
sock = urllib.urlopen("http://www.google.com/")
File "C:\Python25\lib\urllib.py", line 82, in urlopen
return opener.open(url)
File "C:\Python25\lib\urllib.py", line 190, in open
return getattr(self, name)(url)
File "C:\Python25\lib\urllib.py", line 325, in open_http
h.endheaders()
File "C:\Python25\lib\httplib.py", line 856, in endheaders
self._send_output()
File "C:\Python25\lib\httplib.py", line 728, in _send_output
self.send(msg)
File "C:\Python25\lib\httplib.py", line 695, in send
self.connect()
File "C:\Python25\lib\httplib.py", line 679, in connect
raise socket.error, msg
IOError: [Errno socket error] (10060, 'Operation timed out')
I'm behind my company's firewall. Would that cause a problem? If it
does, How do I get around it?
Hi Salvatore,
Even if I catch the exceptions in a loop it goes on forever.
- ken
Dennis,
I tried a ProxyHandler with the following code ...
proxy_support = urllib2.ProxyHandler({})
opener = urllib2.build_opener(proxy_support)
urllib2.install_opener(opener)
.... but it's giving me the same result.
Then I tried to tunnel using code from ... http://aspn.activestate.com/ASPN/Coo.../Recipe/213238
.... but it too gave me an error ...
Traceback (most recent call last):
File "<pyshell#7>", line 1, in <module>
tunnel.run(tunnel_this)
File "C:/Python25/My Python/PyTunnel.py", line 124, in run
Threads.append( thread_it(tid=0,proxy=self.get_proxy(),\
File "C:/Python25/My Python/PyTunnel.py", line 81, in get_proxy
proxy.connect((self._phost,self._pport))
File "<string>", line 1, in connect
gaierror: (11001, 'getaddrinfo failed') kg******@gmail.com a écrit :
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:
Traceback (most recent call last):
File "<pyshell#5>", line 1, in <module>
sock = urllib.urlopen("http://www.google.com/")
File "C:\Python25\lib\urllib.py", line 82, in urlopen
return opener.open(url)
File "C:\Python25\lib\urllib.py", line 190, in open
return getattr(self, name)(url)
File "C:\Python25\lib\urllib.py", line 325, in open_http
h.endheaders()
File "C:\Python25\lib\httplib.py", line 856, in endheaders
self._send_output()
File "C:\Python25\lib\httplib.py", line 728, in _send_output
self.send(msg)
File "C:\Python25\lib\httplib.py", line 695, in send
self.connect()
File "C:\Python25\lib\httplib.py", line 679, in connect
raise socket.error, msg
IOError: [Errno socket error] (10060, 'Operation timed out')
I'm behind my company's firewall. Would that cause a problem? If it
does, How do I get around it?
See the documentation for urllib.urlopen:
"""
In a Windows environment, if no proxy environment variables are set,
proxy settings are obtained from the registry's Internet Settings
section.
"""
Remove Proxy configuration under IE and try again
(don't use Ie anymore ;0) This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: C GIllespie |
last post by:
Dear All,
I'm having problems using the urllib module and was wondering if anyone
could suggest a solution. The only thing I can thing of is that I'm using at
university and my uni uses a...
|
by: Andreas Dahl |
last post by:
Hi,
I use urllib to retrieve data via HTTP. Unfortunately my program crashes
after a while (after some loops) because the connection timed out.
raise socket.error, msg
IOError: (60,...
|
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: Chris Tavares |
last post by:
Hi all. I'm currently tracking down a problem in a little script I have,
and I was hoping that those more experienced than myself could weigh in.
The script's job is to grab the status page off a...
|
by: Johnny Lee |
last post by:
Hi,
I was using urllib to grab urls from web. here is the work flow of
my program:
1. Get base url and max number of urls from user
2. Call filter to validate the base url
3. Read the source...
|
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: 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...
|
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: Iain Dalton |
last post by:
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...
|
by: DolphinDB |
last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation.
Take...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
| |