Accessing DataType of a loaded band throws an exception

Bug #2070102 reported by Shihab E.
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
gdal (Ubuntu)
New
Undecided
Unassigned

Bug Description

When using the GDAL python API (package pyhon3-gdal), attempting to access the data type of a loaded raster's band (via the property DataType) throws the exception:
"in method 'Band_DataType_get', argument 1 of type 'GDALRasterBandShadow *'"

The issue was limited (in my case) to Ubuntu 24.04. Discovered on a month-old installation, and reproduced on a second machine using the Ubuntu live (running from a thumb drive) environment with freshly fetched packages (version 3.8.4+dfsg-3ubuntu3).

When running the same test code on an Ubuntu 22.04 installation (latest available python3-gdal version is 3.4.1+dfsg-1build4) for the same raster, it produces the correct output without throwing any exceptions.

A simple python code to test this:
---------------------------------------------------------------------------------------------------
from osgeo import gdal
from osgeo.gdalconst import GA_ReadOnly

try:
    rasterDataType = gdal.Open("/path/to/some/raster", GA_ReadOnly).GetRasterBand(1).DataType
except Exception as e:
    print(e)
---------------------------------------------------------------------------------------------------

Several datasets were used in testing. e.g. Landast 8 Collection 2 Level 2 rasters, obtained from https://earthexplorer.usgs.gov

(P.S: This is my first ever bug report. Would appreciate the patience and advice regarding any mistakes or missing information. This report was initiated using ubuntu-bug, unless I misunderstood the process, it collects and includes all the relevant version/package information)

ProblemType: Bug
DistroRelease: Ubuntu 24.04
Package: python3-gdal 3.8.4+dfsg-3ubuntu3
ProcVersionSignature: Ubuntu 6.8.0-35.35-generic 6.8.4
Uname: Linux 6.8.0-35-generic x86_64
NonfreeKernelModules: nvidia_modeset nvidia
ApportVersion: 2.28.1-0ubuntu3
Architecture: amd64
CasperMD5CheckResult: pass
CurrentDesktop: ubuntu:GNOME
Date: Sat Jun 22 17:59:05 2024
InstallationDate: Installed on 2024-06-01 (21 days ago)
InstallationMedia: Ubuntu 24.04 LTS "Noble Numbat" - Release amd64 (20240424)
SourcePackage: gdal
UpgradeStatus: No upgrade log present (probably fresh install)

Revision history for this message
Shihab E. (shihab-e) wrote :
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.