urllib.urlopen

2005-12-17 Thread JabaPyth
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 "", 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?

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: urllib.urlopen

2005-12-17 Thread JabaPyth
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 "", 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: 

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: urllib.urlopen

2005-12-18 Thread JabaPyth
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

-- 
http://mail.python.org/mailman/listinfo/python-list


Python dot-equals (syntax proposal)

2010-04-30 Thread Jabapyth
At least a few times a day I wish python had the following shortcut
syntax:

vbl.=func(args)

this would be equivalent to

vbl = vbl.func(args)

example:

foo = "Hello world"
foo.=split(" ")
print foo
# ['Hello', 'world']

and I guess you could generalize this to

vbl.=[some text]
#
vbl = vbl.[some text]

e.g.

temp.=children[0]
# temp = temp.children[0]

thoughts?
-- 
http://mail.python.org/mailman/listinfo/python-list