Extremely strange problem with httplib/urllib

HEMMI Shigeru hemmi at crc.co.jp
Tue Jun 19 20:50:17 EDT 2001


Gustaf Liljegren wrote:
> 
> Python 2.1 on Win98SE:
> 
> I have got some experience with httplib and urllib by now, but suddenly
> both are causing "invalid page fault" errors in Windows. Here's all I need
> to do:
> 
> import urllib
> f = urllib.urlopen('http://www.google.com')
> 
> And the nasty error looks like this:
> 
> PYTHON caused an invalid page fault in
> module KERNEL32.DLL at 017f:bff7b992.
(snip)

I am using Python 2.1 on Win98.
I was able to use urllib from my computer.


# This example is slightly modified that in  http://www.gembook.org/python/
# which is written by Mr. Atuso Ishimoto.
import urllib
#
def gethtml(url): 
    try:
        f = urllib.urlopen(url) 
    except:
        print 'Unable to connect ',url 
        return None
    return f.readlines()
def main(targeturl):
  html = gethtml(targeturl)
  for i in range (5):
      print html[i],

if __name__=='__main__':
     main('http://www.python.org')


And I get:
C:\>python downloadURL.py
<HTML>
<!-- THIS PAGE IS AUTOMATICALLY GENERATED.  DO NOT EDIT. -->
<!-- Mon Jun 18 20:06:55 2001 -->
<!-- USING HT2HTML 1.1 -->
<!-- SEE http://www.python.org/~bwarsaw/software/pyware.html -->

regards,

-- 
HEMMI Shigeru



More information about the Python-list mailing list