a name error

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Penny Y.

    a name error

    Hello,

    I run this small script:

    import urllib2,sys
    try:
    r=urllib2.urlop en("http://un-know-n.com/")
    except URLError,e:
    print str(e)
    sys.exit(1)

    print r.info()


    But got the errors:

    Traceback (most recent call last):
    File "t1.py", line 4, in ?
    except URLError,e:
    NameError: name 'URLError' is not defined


    Why these is not the name of URLError? I saw it on this module's page:

    The official home of the Python Programming Language


    Thanks.

Working...