2

I am trying to open a GeoTIFF using the following code:

filename = r"C:\Users\user\Downloads\grdtocsv\ers_to_tiff\old.tiff"
sourceds = gdal.Open(filename)

The thing is that I dont get any error and the 'sourceds' is empty

The version of GDAL is 3.4.3

Vince
20.5k16 gold badges49 silver badges65 bronze badges
asked Dec 6, 2022 at 0:04
1
  • Enable exceptions then see what error you get: gdal.org/api/… Commented Dec 6, 2022 at 0:07

1 Answer 1

5

This is a "gotcha" in the GDAL Python bindings.

from osgeo import gdal
gdal.UseExceptions() # <---- Add this line
gdal.open(r'C:\Users\user\Downloads\grdtocsv\ers_to_tiff\old.tiff')

https://gdal.org/api/python_gotchas.html#python-bindings-do-not-raise-exceptions-unless-you-explicitly-call-useexceptions

answered Dec 6, 2022 at 0:15

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.