def load(self, shapefile=None):
        """Opens a shapefile from a filename or file-like
        object. Normally this method would be called by the
        constructor with the file object or file name as an
        argument."""
        if shapefile:
            (shapeName, ext) = os.path.splitext(shapefile)
            self.shapeName = shapeName
            try:
                self.shp = open("%s.shp" % shapeName, "rb")
            except IOError:
                raise ShapefileException("Unable to open %s.shp" % shapeName)
            try:
                self.shx = open("%s.shx" % shapeName, "rb")
            except IOError:
                raise ShapefileException("Unable to open %s.shx" % shapeName)
            try:
                self.dbf = open("%s.dbf" % shapeName, "rb")
            except IOError:
                raise ShapefileException("Unable to open %s.dbf" % shapeName)
        if self.shp:
            self.__shpHeader()
        if self.dbf:
            self.__dbfHeader()
def load ( self , shapefile = None ) : if shapefile : ( shapeName , ext ) = os . path . splitext ( shapefile ) self . shapeName = shapeName try : self . shp = open ( "%s.shp" % shapeName , "rb" ) except IOError : raise ShapefileException ( "Unable to open %s.shp" % shapeName ) try : self . shx = open ( "%s.shx" % shapeName , "rb" ) except IOError : raise ShapefileException ( "Unable to open %s.shx" % shapeName ) try : self . dbf = open ( "%s.dbf" % shapeName , "rb" ) except IOError : raise ShapefileException ( "Unable to open %s.dbf" % shapeName ) if self . shp : self . __shpHeader ( ) if self . dbf : self . __dbfHeader ( )
Opens a shapefile from a filename or file-like
        object. Normally this method would be called by the
        constructor with the file object or file name as an
        argument.