[gdal-dev] GDAL Python bindings disables setting a non-zero exit code

Luke Pinner pinner.luke at gmail.com
Tue Sep 25 20:55:43 PDT 2012


Importing the gdal bindings in python seems to disable setting a non-zero
exit code.  Running the following batch file demonstrates the issue:

Running the following batch file demonstrates the issue:

@echo off
set pycmd=python -c "from osgeo import gdal;import sys;sys.exit(1)"
echo %pycmd%
%pycmd%
echo ERRORLEVEL=%ERRORLEVEL%
echo.
set  pycmd=python -c "import sys;sys.exit(1)"
echo %pycmd%
%pycmd%
echo ERRORLEVEL=%ERRORLEVEL%
echo.
pause

This prints out:
python -c "from osgeo import gdal;import sys;sys.exit(1)"
ERRORLEVEL=0

python -c "import sys;sys.exit(1)"
ERRORLEVEL=1


Tested on Windows 7 Pro and Server 2008 R2 64bit with GDAL 1.9.1 MSVC2008
(Win32) with 32bit python 2.6.5 and GDAL 1.9.1 MSVC2008 (Win64) with 64bit
python 2.6.6.

I couldn't find a ticket reporting the issue in trac. Is this a known
issue? Is it worthy of a ticket? Are there any known workarounds?


Regards
Luke
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20120926/6c8cf835/attachment.html>


More information about the gdal-dev mailing list