Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ReadAsArray() ends with SIGSEGV #1020

Closed
digital-idiot opened this issue Oct 17, 2018 · 1 comment
Closed

ReadAsArray() ends with SIGSEGV #1020

digital-idiot opened this issue Oct 17, 2018 · 1 comment

Comments

@digital-idiot
Copy link

digital-idiot commented Oct 17, 2018

Expected behavior and actual behavior.

I expected to be able to read a TIFF into a <numpy.ndarray> using the usual gdal function ReadAsArray(). But it exits with exit code 139 (interrupted by signal 11: SIGSEGV). I tried with different tiff file, also tried the same with python2 and ended up with the same exit code in all the cases. Stack Exchange post about same issue in the Mac OS: Stack Exchange Post

Steps to reproduce the problem.

Below is the code to reproduce the problem

import numpy as np
import gdal
band1 = gdal.Open("liss3_poanta.tif").GetRasterBand(1)
b1 = band1.ReadAsArray() # This is where SIGSEGV occurs

Operating system

Linux hell-fire 4.19.0-1-MANJARO SMP PREEMPT x86_64 GNU/Linux

GDAL version and provenance

GDAL 2.3.2, released 2018/09/21, installed from community repository

@rouault
Copy link
Member

rouault commented Oct 17, 2018

You need to keep a reference to the dataset. So

ds = gdal.Open("liss3_poanta.tif")
band1 = ds.GetRasterBand(1)
b1 = band1.ReadAsArray() # This is where SIGSEGV occurs

See https://trac.osgeo.org/gdal/wiki/PythonGotchas

@rouault rouault closed this as completed Oct 17, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants