I am having trouble using the Polygonize function in python. The cookbook example for this can be found here.
The relevant portion of my code is:
sourceRaster = gdal.Open('myraster.tif')
band = sourceRaster.GetRasterBand(1)
bandArray = band.ReadAsArray()
outShapefile = "polygonized"
driver = ogr.GetDriverByName("ESRI Shapefile")
if os.path.exists(outShapefile+".shp"):
driver.DeleteDataSource(outShapefile+".shp")
outDatasource = driver.CreateDataSource(outShapefile+ ".shp")
outLayer = outDatasource.CreateLayer("polygonized", srs=None)
gdal.Polygonize( band, None, outLayer, -1, [], callback=None )
outDatasource.Destroy()
sourceRaster = None
I know that the band has relevant information, here is a snippet of bandArray:
array([[ 4., 4., 3., 3., 3., 2., 2., 2., 2., 3., 3., 3., 3.,
3., 3., 3., 3., 4., 4., 4., 4., 4., 4., 4., 4., 4.,
4., 4., 4., 4.],
When I open the attribute table in QGIS, it is empty:

Edit:
The conversion works just fine in QGIS using Raster -> Conversion -> Polygonize tool
Screenshot of raster to be polygonized:

And screenshot of resultant conversion from QGIS tool:

I am using the Enthought distro on Windows 7, GDAL version 1.10.0-3
The problem is that I cannot polygonize a raster in python using GDAL and the cookbook example, I can polygonize this same raster with no problem in the QGIS GUI