How to Solve NameError: name 'gdal' is not defined -- osgeo

Solution: Import the 'gdal' module

To Solve the error, add the following line to the top of your code.

from osgeo import gdal

 

For more information:
Python osgeo gdal