Problem with GeoMipTerrain

I am trying to use GeoMipTerrain to create a maze type terrain. The problem I am encountering is that when my script gets to the terrain.generate() command Panda just freezes until it expands past its memory allotment and terminates. I tried running PStats and it also hangs when I try the terrain.generate() command. I have tried several really simple heightmaps and none of them have changed this. I have also tried changing the settings to make the geometry easier to make (exact size heightmap, making blocks bigger, changing the LOD, etc.). I am running this on a pretty faster system with plenty of memory, does anyone have any idea what is going on? The code I am using is below.

 class SceneBuilder(DirectObject):
    def __init__(self):
        self.terrain = GeoMipTerrain("Terrain")
        self.terrain.setHeightfield(Filename("C:/heightmap.jpg"))
        self.terrain.setBlockSize(128)
        #terrain.setBruteforce(True)
        self.terrain.getRoot().reparentTo(render)
        self.terrain.getRoot().setSz(25) 
        self.terrain.setFactor(32)
        self.terrain.setMinLevel(10)

        def generate():
            print "generating"
            self.terrain.generate()

        self.accept("space", generate) 
        
s = SceneBuilder()
run()

Thanks in advance.

Actually, you gave it an invalid heightfield. Try this instead:

self.terrain.setHeightfield(Filename("/c/heightmap.jpg"))

To make sure the heightfield is loaded correctly, assert that it returns True:

assert self.terrain.setHeightfield(Filename("/c/heightmap.jpg"))

I believe 1.5.4 and later throw an error when given an invalid heightfield instead of just hanging.

Yeah that was my problem.

On the one hand I am happy that its fixed, on the other I am embarrassed it was something so simple.

Thanks again.