urllib on windows machines

W

william

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
 
S

Scott David Daniels

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: (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: '<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
(e-mail address removed)
 
W

william

Thanks Scott
This part I can help you with:
(67, 'Sep 28 2005 12:41:11')
(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
 
S

Scott David Daniels

... [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.
 
S

Steve Holden

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.
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

Forum statistics

Threads
473,787
Messages
2,569,627
Members
45,328
Latest member
66Teonna9

Latest Threads

Top