'Use URLopener().open(file) instead of open(file, \'r\').'

def open(self, fullurl, data=None):

    fullurl = unwrap(toBytes(fullurl))
    fullurl = quote(fullurl, safe="%/:=&?~#+!$,;'@()*[]|")
    if (self.tempcache and (fullurl in self.tempcache)):
        (filename, headers) = self.tempcache[fullurl]
        fp = open(filename, 'rb')
        return addinfourl(fp, headers, fullurl)
    (urltype, url) = splittype(fullurl)
    if (not urltype):
        urltype = 'file'
    if (urltype in self.proxies):
        proxy = self.proxies[urltype]
        (urltype, proxyhost) = splittype(proxy)
        (host, selector) = splithost(proxyhost)
        url = (host, fullurl)
    else:
        proxy = None
    name = ('open_' + urltype)
    self.type = urltype
    name = name.replace('-', '_')
    if (not hasattr(self, name)):
        if proxy:
            return self.open_unknown_proxy(proxy, fullurl, data)
        else:
            return self.open_unknown(fullurl, data)
    try:
        if (data is None):
            return getattr(self, name)(url)
        else:
            return getattr(self, name)(url, data)
    except socket.error as msg:
        raise IOError, ('socket    error', msg), sys.exc_info()[2]
