Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #56876
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!ecngs!feeder2.ecngs.de!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <jerome@jolimont.fr> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.022 |
| X-Spam-Evidence | '*H*': 0.96; '*S*': 0.00; 'socket': 0.07; 'urllib2': 0.07; 'python': 0.11; '"python': 0.16; 'seconds.': 0.16; 'subject:issue': 0.16; 'all.': 0.16; 'server,': 0.19; 'thanks.': 0.20; 'import': 0.22; 'print': 0.22; 'header:User-Agent:1': 0.23; 'script': 0.25; 'suggested': 0.26; 'tried': 0.27; "i'm": 0.30; 'run': 0.32; 'received:fr': 0.33; 'something': 0.35; 'but': 0.35; 'version': 0.36; "didn't": 0.36; 'skip:- 20': 0.37; 'to:addr :python-list': 0.38; 'to:addr:python.org': 0.39; 'skip:u 10': 0.60; 'from:charset:utf-8': 0.61; 'results': 0.69; 'difference.': 0.84 |
| To | <python-list@python.org> |
| Subject | urllib2 timeout issue |
| X-PHP-Originating-Script | 0:main.inc |
| MIME-Version | 1.0 |
| Content-Type | text/plain; charset=UTF-8 |
| Content-Transfer-Encoding | 8bit |
| Date | Wed, 16 Oct 2013 11:21:00 +0200 |
| From | Jérôme <jerome@jolimont.fr> |
| X-Sender | jerome@jolimont.fr |
| User-Agent | Roundcube Webmail/0.7.2 |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.1110.1381915633.18130.python-list@python.org> (permalink) |
| Lines | 44 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1381915633 news.xs4all.nl 15901 [2001:888:2000:d::a6]:42733 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:56876 |
Show key headers only | View raw
Hi all.
I'm having troubles with urllib2 timeout.
See the following script :
----------------------------
import urllib2
result = urllib2.urlopen("http://dumdgdfgdgmyurl.com/")
print result.readline()
----------------------------
If run on my Debian Wheezy computer, or on my Debian Squeeze server,
the answer is instantaneous :
[...]
urllib2.URLError: <urlopen error [Errno -2] Name or service not known>
When run on my Raspberry Pi with Raspian Wheezy, the answer is
identical but it takes 10 seconds.
I tried
result = urllib2.urlopen("http://dumdgdfgdgmyurl.com/", timeout=5)
but I get the same results : instantaneous on Debian, 10 secondes on
RPi.
I also added this, as suggested on some StackOverflow pages :
import socket
socket.setdefaulttimeout(5)
and it didn't make any difference.
In both cases, Python version is "Python 2.7.3".
Am I missing something ?
Thanks.
--
Jérôme
Back to comp.lang.python | Previous | Next — Next in thread | Find similar | Unroll thread
urllib2 timeout issue Jérôme <jerome@jolimont.fr> - 2013-10-16 11:21 +0200 Re: urllib2 timeout issue Piet van Oostrum <piet@vanoostrum.org> - 2013-10-16 07:58 -0400
csiph-web