It's failing because CreateTerrain() is used to create a new terrain from scratch (i.e. not from an image). If you look at the CreateTerrain() docs you'll see it takes a grid size as a parameter, not an image file.
In the above example, 'map' points to a terrain that uses the heightmap you created.
To 'fix' the above example, remove 'terrain = CreateTerrain(map)' and you should be good to go.
In the above example, 'map' points to a terrain that uses the heightmap you created.
To 'fix' the above example, remove 'terrain = CreateTerrain(map)' and you should be good to go.