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 9205
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...
|
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.
...
|
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...
|
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.
...
|
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...
|
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...
|
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...
|
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...
|
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...
|
by: tammygombez |
last post by:
Hey everyone!
I've been researching gaming laptops lately, and I must say, they can get pretty expensive. However, I've come across some great...
|
by: concettolabs |
last post by:
In today's business world, businesses are increasingly turning to PowerApps to develop custom business applications. PowerApps is a powerful tool...
|
by: better678 |
last post by:
Question:
Discuss your understanding of the Java platform. Is the statement "Java is interpreted" correct?
Answer:
Java is an object-oriented...
|
by: CD Tom |
last post by:
This happens in runtime 2013 and 2016. When a report is run and then closed a toolbar shows up and the only way to get it to go away is to right...
|
by: CD Tom |
last post by:
This only shows up in access runtime. When a user select a report from my report menu when they close the report they get a menu I've called Add-ins...
|
by: jalbright99669 |
last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
|
by: antdb |
last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine
In the overall architecture, a new "hyper-convergence" concept was...
|
by: Matthew3360 |
last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function.
Here is my code.
...
|
by: AndyPSV |
last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...
| |