Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
python problem: can't urlopen
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
frank1980
Tux's lil' helper
Tux's lil' helper


Joined: 19 Feb 2006
Posts: 103

PostPosted: Tue May 01, 2007 4:24 am    Post subject: python problem: can't urlopen Reply with quote

Yesterday, I found my python can't use urlopen function, not only module urllib,but also urllib2.
In console mode, try " file=urllib.urlopen('http://www.google.com'), it raises error like this:

Code:
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "/usr/lib64/python2.4/urllib.py", line 82, in urlopen
    return opener.open(url)
  File "/usr/lib64/python2.4/urllib.py", line 190, in open
    return getattr(self, name)(url)
  File "/usr/lib64/python2.4/urllib.py", line 313, in open_http
    h.endheaders()
  File "/usr/lib64/python2.4/httplib.py", line 798, in endheaders
    self._send_output()
  File "/usr/lib64/python2.4/httplib.py", line 679, in _send_output
    self.send(msg)
  File "/usr/lib64/python2.4/httplib.py", line 646, in send
    self.connect()
  File "/usr/lib64/python2.4/httplib.py", line 614, in connect
    socket.SOCK_STREAM):
IOError: [Errno socket error] (-2, 'Name or service not known')


I try to boot with livecd 2006.1, it's OK, and the same version of python. Also I re-emerged python, but still failed.
Back to top
View user's profile Send private message
KRF
Tux's lil' helper
Tux's lil' helper


Joined: 17 Jun 2006
Posts: 124
Location: Germany

PostPosted: Fri May 04, 2007 2:01 pm    Post subject: Reply with quote

Sounds like a dns problem, the python module cannot lookup google.com's ip address.
_________________

Gentoo Linux, running kde-3.5
CPU: i686 Intel P4 2.80GHz | RAM: 2048MB DDR
Profile: gentoo-sources-2.6.23*, gcc-4.1*, portage-2.1.3* (2007.0)

Please add [SOLVED] to your message title if your problem is solved.
Back to top
View user's profile Send private message
frank1980
Tux's lil' helper
Tux's lil' helper


Joined: 19 Feb 2006
Posts: 103

PostPosted: Mon May 07, 2007 8:06 am    Post subject: Reply with quote

It's not only python's problem, but also perl\ruby, all the same. :x
I don't know how to deal with it, it's system's problem.
If I use IP directly, it's OK
Back to top
View user's profile Send private message
d_m
Guru
Guru


Joined: 12 Jun 2003
Posts: 570
Location: Philadelphia, PA, USA

PostPosted: Mon May 07, 2007 3:44 pm    Post subject: Reply with quote

If you ping the hostname you are trying to connect to... what happens?

Does DNS work in firefox/etc.?
_________________
The name that can be named is not the eternal name.
Back to top
View user's profile Send private message
frank1980
Tux's lil' helper
Tux's lil' helper


Joined: 19 Feb 2006
Posts: 103

PostPosted: Tue May 08, 2007 1:37 pm    Post subject: Reply with quote

d_m wrote:
If you ping the hostname you are trying to connect to... what happens?

Does DNS work in firefox/etc.?


I ping www.google.com,sounds good

Code:
PING www-china.l.google.com (66.249.89.99) 56(84) bytes of data.
64 bytes from jp-in-f99.google.com (66.249.89.99): icmp_seq=1 ttl=244 time=195 ms
64 bytes from jp-in-f99.google.com (66.249.89.99): icmp_seq=2 ttl=243 time=194 ms


DNS workd fine in firefox, konq............

by the way, my computer behind double routers.
Back to top
View user's profile Send private message
frank1980
Tux's lil' helper
Tux's lil' helper


Joined: 19 Feb 2006
Posts: 103

PostPosted: Sat May 12, 2007 3:14 pm    Post subject: Reply with quote

One time I updated my system,sys-auth/nss-mdns blocking net-misc/mDNSResponder,I del ti, is that point?
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum