472,364 Members | 2,047 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

urllib on windows machines

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 even telnet the host on port 80.

Thus network seems good, but not for python ;-(.

Does any windows specialist can guide me (a poor linux user) to get
Network functionalitiies with python on windows ?

I'm runnning on Windows XP (sorry to not give more, I don't know the
equivalent of uname).
I'm using standard (msi) python-2.4.2

Thanks.

test.py contains the following lines:
"
import urllib
g=urllib.urlopen('http://www.google.com')
"
C:\Temp>python test.py
Traceback (most recent call last):
File "test.py", line 2, in ?
g=urllib.urlopen('http://www.google.com')
File "c:\william\tools\python24\lib\urllib.py", line 77, in urlopen
return opener.open(url)
File "c:\william\tools\python24\lib\urllib.py", line 185, in open
return getattr(self, name)(url)
File "c:\william\tools\python24\lib\urllib.py", line 308, in
open_http
h.endheaders()
File "c:\william\tools\python24\lib\httplib.py", line 795, in
endheaders
self._send_output()
File "c:\william\tools\python24\lib\httplib.py", line 676, in
_send_output
self.send(msg)
File "c:\william\tools\python24\lib\httplib.py", line 643, in send
self.connect()
File "c:\william\tools\python24\lib\httplib.py", line 627, in connect
raise socket.error, msg
IOError: [Errno socket error] (10053, 'Software caused connection
abort')

C:\Temp>ping www.google.com

Pinging www.l.google.com [66.249.93.104] with 32 bytes of data:

Reply from 66.249.93.104: bytes=32 time=22ms TTL=246
Reply from 66.249.93.104: bytes=32 time=23ms TTL=246
Reply from 66.249.93.104: bytes=32 time=22ms TTL=246
Reply from 66.249.93.104: bytes=32 time=22ms TTL=246

Ping statistics for 66.249.93.104:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 22ms, Maximum = 23ms, Average = 22ms

Dec 3 '05 #1
4 3485
wi*****@opensource4you.com wrote:
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).
.... Thus network seems good, but not for python ;-(.

Does any windows specialist can guide me (a poor linux user) to get
Network functionalitiies with python on windows ?

I'm runnning on Windows XP (sorry to not give more, I don't know the
equivalent of uname).
This part I can help you with:
import platform
platform.platform() 'Windows-2000-5.0.2195-SP4' # in my case platform.architecture() ('32bit', 'WindowsPE') platform.python_version() '2.4.2' platform.python_compiler() 'MSC v.1310 32 bit (Intel)' platform.python_build() (67, 'Sep 28 2005 12:41:11')
test.py contains the following lines:
"
import urllib
g=urllib.urlopen('http://www.google.com')
"
...


I'm on a Win2K 2.4.2 system, and Idle let's me do: import urllib
g = urllib.urlopen('http://www.google.com')
g.read(12)

'<html><head>'

So off-hand, I'd suspect some firewall thingie is getting in the way.
Can you "bless" \Python24\python.exe and \Python24\pythonw.exe as
applications allowed to do net traffic?

--Scott David Daniels
sc***********@acm.org
Dec 3 '05 #2
Thanks Scott

This part I can help you with:
>>> import platform
>>> platform.platform() 'Windows-2000-5.0.2195-SP4' # in my case >>> platform.architecture() ('32bit', 'WindowsPE') >>> platform.python_version() '2.4.2' >>> platform.python_compiler() 'MSC v.1310 32 bit (Intel)' >>> platform.python_build() (67, 'Sep 28 2005 12:41:11')
import platform
platform.platform() 'Windows-XP-5.1.2600' platform.architecture() ('32bit', 'WindowsPE') platform.python_version() '2.4.2' platform.python_compiler() 'MSC v.1310 32 bit (Intel)' platform.python_build()

(67, 'Sep 28 2005 12:41:11')

So off-hand, I'd suspect some firewall thingie is getting in the way.
Can you "bless" \Python24\python.exe and \Python24\pythonw.exe as
applications allowed to do net traffic?


Bingo!!!!!
That's the problem: "Blocked outgoing TCP - Source Local: (1898)
Destination: 67.18.1.164: http(80)"

But why the "telnet www.google.com 80" is wroking ?
Why Firefox is running ?

Thanks.

William

Dec 3 '05 #3
wi*****@opensource4you.com wrote:
...

[I said]
So off-hand, I'd suspect some firewall thingie is getting in the way.
Can you "bless" \Python24\python.exe and \Python24\pythonw.exe as
applications allowed to do net traffic?


Bingo!!!!!
That's the problem: "Blocked outgoing TCP - Source Local: (1898)
Destination: 67.18.1.164: http(80)"

But why the "telnet www.google.com 80" is wroking ?
Why Firefox is running ?


Because (and I'm guessing here), telnet, ftp, firefox, ... are all
web-specific, and they are not regarded as possible monsters if they
try to connect to the web. I'd like the chance to deny all programs
that I don't expect to connect out the chance to do so, but there has
got to be a way to turn it off. Maybe there are some adjustments to
the program that emitted the "Blocked outgoing TCP - ..." message.

--
-Scott David Daniels
sc***********@acm.org
Dec 3 '05 #4
wi*****@opensource4you.com wrote:
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 even telnet the host on port 80.

Thus network seems good, but not for python ;-(.

Does any windows specialist can guide me (a poor linux user) to get
Network functionalitiies with python on windows ?

I'm runnning on Windows XP (sorry to not give more, I don't know the
equivalent of uname).
I'm using standard (msi) python-2.4.2

Thanks.

test.py contains the following lines:
"
import urllib
g=urllib.urlopen('http://www.google.com')
"
C:\Temp>python test.py
Traceback (most recent call last):
File "test.py", line 2, in ?
g=urllib.urlopen('http://www.google.com')
File "c:\william\tools\python24\lib\urllib.py", line 77, in urlopen
return opener.open(url)
File "c:\william\tools\python24\lib\urllib.py", line 185, in open
return getattr(self, name)(url)
File "c:\william\tools\python24\lib\urllib.py", line 308, in
open_http
h.endheaders()
File "c:\william\tools\python24\lib\httplib.py", line 795, in
endheaders
self._send_output()
File "c:\william\tools\python24\lib\httplib.py", line 676, in
_send_output
self.send(msg)
File "c:\william\tools\python24\lib\httplib.py", line 643, in send
self.connect()
File "c:\william\tools\python24\lib\httplib.py", line 627, in connect
raise socket.error, msg
IOError: [Errno socket error] (10053, 'Software caused connection
abort')

C:\Temp>ping www.google.com

Pinging www.l.google.com [66.249.93.104] with 32 bytes of data:

Reply from 66.249.93.104: bytes=32 time=22ms TTL=246
Reply from 66.249.93.104: bytes=32 time=23ms TTL=246
Reply from 66.249.93.104: bytes=32 time=22ms TTL=246
Reply from 66.249.93.104: bytes=32 time=22ms TTL=246

Ping statistics for 66.249.93.104:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 22ms, Maximum = 23ms, Average = 22ms

Something is clearly wrong. here's *my* XP system connecting to Google:

C:\Steve>python
Python 2.4.1 (#65, Mar 30 2005, 09:13:57) [MSC v.1310 32 bit (Intel)] on
win32
Type "help", "copyright", "credits" or "license" for more information.
import urllib
f = urllib.urlopen('http://www.google.com')
len(f.read()) 2690


I suspect you may have a firewall problem: you could need to tell your
(XP Service Pack 2 personal) firewall it's OK for Python to make
outbound network connections.

regards
Steve
--
Steve Holden +44 150 684 7255 +1 800 494 3119
Holden Web LLC www.holdenweb.com
PyCon TX 2006 www.python.org/pycon/

Dec 4 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Gary Feldman | last post by:
I think I've found a deficiency in the design of urllib related to https. In order to complete an https connection, it appears that URLOpener and hence FancyURLOpener require the key and cert...
7
by: Fuzzyman | last post by:
I'm writing a function that will query the comp.lang.python newsgroup via google groups....... (I haven't got nntp access from work..) I'm using urllib (for the first time)..... and google don't...
3
by: Haim Ashkenazi | last post by:
Hi I'm writing a script that uses urllib on win98. until now I used python 2.3.x (x < 4) and it worked ok. I re-installed windows and installed python 2.3.4 and now I get an error when trying to...
7
by: Stuart McGraw | last post by:
I just spent a $*#@!*&^&% hour registering at ^$#@#%^ Sourceforce and trying to submit a Python bug report but it still won't let me. I give up. Maybe someone who cares will see this post, or...
1
by: Astan Chee | last post by:
Hi Guys, I have a python script which runs perfectly on my machine. However a machine that I tested it on gives the following error message: Traceback (most recent call last): File "whip.py",...
6
by: justsee | last post by:
Hi, I'm using Python 2.3 on Windows for the first time, and am doing something wrong in using urllib to retrieve images from urls embedded in a csv file. If I explicitly specify a url and image...
8
by: Gabriel Zachmann | last post by:
Here is a very simple Python script utilizing urllib: import urllib url = "http://commons.wikimedia.org/wiki/Commons:Featured_pictures/chronological" print url print file = urllib.urlopen(...
1
by: evanpmeth | last post by:
I have tried multiple ways of posting information to a website and have failed. I have seen this problem on other forums can someone explain or point me to information on how POST works through...
4
by: kgrafals | last post by:
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:
2
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and efficiency. While initially associated with cryptocurrencies...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was proposed, which integrated multiple engines and...
0
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 file that would suck all files in the folder and...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and credentials and received a successful connection...
1
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web server and have made sure to enable curl. I get a...
0
Oralloy
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the synthesis of my design into a bitstream, not the C++...
0
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand. Background colors can be used to highlight important...
0
by: Rahul1995seven | last post by:
Introduction: In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python has gained popularity among beginners and experts...
2
by: Ricardo de Mila | last post by:
Dear people, good afternoon... I have a form in msAccess with lots of controls and a specific routine must be triggered if the mouse_down event happens in any control. Than I need to discover what...

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.