473,406 Members | 2,705 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

How to download web page using python code?

Hi all, I am new bee in Python programming...
I am trying to download web page using python code

code:
import urllib

# Get a file-like object for the Python Web site's home page.

f = urllib.urlopen("http://www.python.org")

# Read from the object, storing the page's contents in 's'.

s = f.read()

f.close()

and ERROR is
Traceback (most recent call last):
File "C:\Python26\clk.py", line 5, in <module>
f = urllib.urlopen("http://www.python.org")
File "C:\Python26\lib\urllib.py", line 87, in urlopen
return opener.open(url)
File "C:\Python26\lib\urllib.py", line 203, in open
return getattr(self, name)(url)
File "C:\Python26\lib\urllib.py", line 338, in open_http
h.endheaders()
File "C:\Python26\lib\httplib.py", line 868, in endheaders
self._send_output()
File "C:\Python26\lib\httplib.py", line 740, in _send_output
self.send(msg)
File "C:\Python26\lib\httplib.py", line 699, in send
self.connect()
File "C:\Python26\lib\httplib.py", line 683, in connect
self.timeout)
File "C:\Python26\lib\socket.py", line 498, in create_connection
for res in getaddrinfo(host, port, 0, SOCK_STREAM):
IOError: [Errno socket error] [Errno 11001] getaddrinfo failed

Please let me know how it is comming....
Thank you well in advance.....
Dec 2 '10 #1
1 9296
dwblas
626 Expert 512MB
It works fine for me. Perhaps there is a firewall or some other impediment that must be traversed.
Dec 2 '10 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Marek Baczek Baczyński | last post by:
:map ,p :!python % <cr> ,p #v+ C:\COMMAND.COM /c python items.py Fatal Python error: unknown scope for super in __init__(14) in items.py symbols: {'multirandrange': 264} locals: {} globals:...
1
by: Andrew Ellem | last post by:
I'm using Python embedded in my app, and I've run into problems creating my own modules. I'm using Python version 2.3 compiled with MSVC .NET (not 2003). When I call Py_InitModule I get the...
1
by: reinhard | last post by:
Our project was developed with Python 2.0 and includes some Tk 8.3 extension widgets as well as python extensions using the CXX interface. After moving to Python 2.3 and TclTk 8.4 our program...
0
by: vincent wehren | last post by:
Hi, Trying to grasp Py_NewInterpreter()in a simple app embedding Python, I was wondering why the following gives me an error: int main() { PyThreadState *tstate; Py_Initialize();
0
by: Vineet Jain | last post by:
I'm running a process which uses python numeric arrays extensively and also does some calculations in c. All objects are created in python or through the Numeric library and then passed to the c...
0
by: beliavsky | last post by:
I have noticed a quirk of Python error messages that I think should be changed. The code x = 1 print x,\ y produces output
3
by: contact | last post by:
I'm trying to get mxDateTime working on a Mac so that I can use pyscopg and cx_Oracle. The Egenix base package builds and installs quite happily, but then when I try to import it I get >> import...
2
by: guenais | last post by:
Hello When I use Pyparallel to access the parallel port in WinXP with Python I get an error saying that this is a priviledged instruction Any clue ? Mike
1
by: p.lavarre | last post by:
Is this interesting Python output? $ gc-object-already-tracked.py ********************************************************************** File...
1
by: mmacrobert | last post by:
Hi Everyone, I've created a 'C' dll that is accessed via ctypes library containing a bunch of functions. I've successfully been able to use the functions. However, I would like to throw python...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.