Skip to content

Commit

Permalink
gdal_fillnodata.py, gdal_pansharpen.py, gdal_polygonize.py, gdal_prox…
Browse files Browse the repository at this point in the history
…imity.py, gdal_sieve.py, rgb2pct.py: avoid potential problem on Windows in verbose mode (fixes #458)
  • Loading branch information
rouault committed Apr 20, 2018
1 parent 999b168 commit 1121758
Show file tree
Hide file tree
Showing 14 changed files with 15 additions and 21 deletions.
1 change: 1 addition & 0 deletions gdal/swig/include/python/callback.i
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ PyProgressProxy( double dfComplete, const char *pszMessage, void *pData )

if( PyErr_Occurred() != NULL )
{
PyErr_Print();
PyErr_Clear();
SWIG_PYTHON_THREAD_END_BLOCK;
return FALSE;
Expand Down
1 change: 1 addition & 0 deletions gdal/swig/python/extensions/gdal_array_wrap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4078,6 +4078,7 @@ PyProgressProxy( double dfComplete, const char *pszMessage, void *pData )

if( PyErr_Occurred() != NULL )
{
PyErr_Print();
PyErr_Clear();
SWIG_PYTHON_THREAD_END_BLOCK;
return FALSE;
Expand Down
1 change: 1 addition & 0 deletions gdal/swig/python/extensions/gdal_wrap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3721,6 +3721,7 @@ PyProgressProxy( double dfComplete, const char *pszMessage, void *pData )

if( PyErr_Occurred() != NULL )
{
PyErr_Print();
PyErr_Clear();
SWIG_PYTHON_THREAD_END_BLOCK;
return FALSE;
Expand Down
1 change: 1 addition & 0 deletions gdal/swig/python/extensions/gnm_wrap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3428,6 +3428,7 @@ PyProgressProxy( double dfComplete, const char *pszMessage, void *pData )

if( PyErr_Occurred() != NULL )
{
PyErr_Print();
PyErr_Clear();
SWIG_PYTHON_THREAD_END_BLOCK;
return FALSE;
Expand Down
1 change: 1 addition & 0 deletions gdal/swig/python/extensions/ogr_wrap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3486,6 +3486,7 @@ PyProgressProxy( double dfComplete, const char *pszMessage, void *pData )

if( PyErr_Occurred() != NULL )
{
PyErr_Print();
PyErr_Clear();
SWIG_PYTHON_THREAD_END_BLOCK;
return FALSE;
Expand Down
2 changes: 1 addition & 1 deletion gdal/swig/python/scripts/gdal_fillnodata.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ def Usage():
if quiet_flag:
prog_func = None
else:
prog_func = gdal.TermProgress
prog_func = gdal.TermProgress_nocb

result = gdal.FillNodata(dstband, maskband,
max_distance, smoothing_iterations, options,
Expand Down
5 changes: 1 addition & 4 deletions gdal/swig/python/scripts/gdal_merge.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,7 @@

from osgeo import gdal

try:
progress = gdal.TermProgress_nocb
except AttributeError:
progress = gdal.TermProgress
progress = gdal.TermProgress_nocb

__version__ = '$id$'[5:-1]
verbose = 0
Expand Down
2 changes: 1 addition & 1 deletion gdal/swig/python/scripts/gdal_pansharpen.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def gdal_pansharpen(argv):
weights = []
format = None
creation_options = []
callback = gdal.TermProgress
callback = gdal.TermProgress_nocb
resampling = None
spat_adjust = None
verbose_vrt = False
Expand Down
2 changes: 1 addition & 1 deletion gdal/swig/python/scripts/gdal_polygonize.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ def GetOutputDriverFor(filename):
if quiet_flag:
prog_func = None
else:
prog_func = gdal.TermProgress
prog_func = gdal.TermProgress_nocb

result = gdal.Polygonize(srcband, maskband, dst_layer, dst_field, options,
callback=prog_func)
Expand Down
2 changes: 1 addition & 1 deletion gdal/swig/python/scripts/gdal_proximity.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ def GetOutputDriverFor(filename):
if quiet_flag:
prog_func = None
else:
prog_func = gdal.TermProgress
prog_func = gdal.TermProgress_nocb

gdal.ComputeProximity(srcband, dstband, options,
callback=prog_func)
Expand Down
5 changes: 1 addition & 4 deletions gdal/swig/python/scripts/gdal_retile.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,7 @@
from osgeo import ogr
from osgeo import osr

try:
progress = gdal.TermProgress_nocb
except AttributeError:
progress = gdal.TermProgress
progress = gdal.TermProgress_nocb


class AffineTransformDecorator:
Expand Down
2 changes: 1 addition & 1 deletion gdal/swig/python/scripts/gdal_sieve.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ def GetOutputDriverFor(filename):
if quiet_flag:
prog_func = None
else:
prog_func = gdal.TermProgress
prog_func = gdal.TermProgress_nocb

result = gdal.SieveFilter(srcband, maskband, dstband,
threshold, connectedness,
Expand Down
5 changes: 1 addition & 4 deletions gdal/swig/python/scripts/pct2rgb.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,7 @@

from osgeo import gdal

try:
progress = gdal.TermProgress_nocb
except AttributeError:
progress = gdal.TermProgress
progress = gdal.TermProgress_nocb

try:
import numpy as Numeric
Expand Down
6 changes: 2 additions & 4 deletions gdal/swig/python/scripts/rgb2pct.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,7 @@ def GetOutputDriverFor(filename):
src_ds.GetRasterBand(2),
src_ds.GetRasterBand(3),
color_count, ct,
callback=gdal.TermProgress,
callback_data='Generate PCT')
callback=gdal.TermProgress_nocb)
else:
pct_ds = gdal.Open(pct_filename)
ct = pct_ds.GetRasterBand(1).GetRasterColorTable().Clone()
Expand Down Expand Up @@ -203,8 +202,7 @@ def GetOutputDriverFor(filename):
src_ds.GetRasterBand(3),
tif_ds.GetRasterBand(1),
ct,
callback=gdal.TermProgress,
callback_data='Generate PCT')
callback=gdal.TermProgress_nocb)

tif_ds = None

Expand Down

0 comments on commit 1121758

Please sign in to comment.