def tileset_exists(filename):
 if (not exists(filename)):
  return False
 db = _connect(filename)
 db.text_factory = bytes
 try:
  db.execute('SELECT name, value FROM metadata LIMIT 1')
  db.execute('SELECT zoom_level, tile_column, tile_row, tile_data FROM tiles LIMIT 1')
 except:
  return False
 return True

def tileset_exists ( filename ) : if ( not exists ( filename ) ) : return False db = _connect ( filename ) db . text_factory = bytes try : db . execute ( 'SELECT name, value FROM metadata LIMIT 1' ) db . execute ( 'SELECT zoom_level, tile_column, tile_row, tile_data FROM tiles LIMIT 1' ) except : return False return True
return true if the tileset exists and appears to have the right tables .