470,648 Members | 1,518 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,648 developers. It's quick & easy.

urllib slow on Leopard

I've recently switched from Ubuntu to OS X Leopard. I have some python
scripts which download info from the web. The scripts were working fine
before on Ubuntu, but urllib seems to work really slowly on Leopard.

I tried an example from the docs:
>>import urllib2
f = urllib2.urlopen('http://www.python.org/')
print f.read(100)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtm
>>>
The line f = ... takes about a minute to return - but otherwise returns
the predicted result. My web connection seems fine, so has anyone got
any ideas as to what the problem might be?
Feb 24 '08 #1
4 2187
On Feb 24, 3:57 pm, mark <m...@privacy.netwrote:
I've recently switched from Ubuntu to OS X Leopard. I have some python
scripts which download info from the web. The scripts were working fine
before on Ubuntu, but urllib seems to work really slowly on Leopard.

I tried an example from the docs:
>>import urllib2
>>f = urllib2.urlopen('http://www.python.org/')
>>print f.read(100)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtm
>>>

The line f = ... takes about a minute to return - but otherwise returns
the predicted result. My web connection seems fine, so has anyone got
any ideas as to what the problem might be?
Nope, but it's not Leopard related. Just checked here and it loaded
in about 1 sec.

Andrť
Feb 24 '08 #2
mark wrote:
I've recently switched from Ubuntu to OS X Leopard. I have some python
scripts which download info from the web. The scripts were working fine
before on Ubuntu, but urllib seems to work really slowly on Leopard.

I tried an example from the docs:
>>>import urllib2
f = urllib2.urlopen('http://www.python.org/')
print f.read(100)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtm
>>>>

The line f = ... takes about a minute to return - but otherwise returns
the predicted result. My web connection seems fine, so has anyone got
any ideas as to what the problem might be?
It likely tries to load the DTD in the background, which requires network access.

http://www.w3.org/blog/systeam/2008/...ve_dtd_traffic

Stefan
Feb 24 '08 #3
mark wrote:
I've recently switched from Ubuntu to OS X Leopard. I have some python
scripts which download info from the web. The scripts were working fine
before on Ubuntu, but urllib seems to work really slowly on Leopard.

I tried an example from the docs:
>>import urllib2
>>f = urllib2.urlopen('http://www.python.org/')
>>print f.read(100)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtm
>>>

The line f = ... takes about a minute to return - but otherwise returns
the predicted result. My web connection seems fine, so has anyone got
any ideas as to what the problem might be?
I found that by configuring the network manually (specifying static IP
address, etc.) it sped the whole thing up. Go figure.
Feb 25 '08 #4
On 24 Feb, 22:14, Stefan Behnel <stefan...@behnel.dewrote:
>
It likely tries to load the DTD in the background, which requires network access.

http://www.w3.org/blog/systeam/2008/...ve_dtd_traffic
This is principally concerned with the standard library XML modules,
not urllib/urllib2 specifically. See the bug report in the tracker:

http://bugs.python.org/issue2124

I'd imagine that it's more likely to be a DNS problem than anything
else.

Paul
Feb 26 '08 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Russell E. Owen | last post: by
reply views Thread by Pieter Edelman | last post: by
1 post views Thread by Timothy Wu | last post: by
6 posts views Thread by justsee | last post: by
5 posts views Thread by supercooper | last post: by
3 posts views Thread by Gordon | last post: by
1 post views Thread by blackbiscuit | last post: by
6 posts views Thread by Massi | last post: by
1 post views Thread by Korara | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.