2012/9/27 Luke Pinner <span dir="ltr"><<a href="mailto:pinner.luke@gmail.com" target="_blank">pinner.luke@gmail.com</a>></span><br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

Thanks Jason, it's definitely GDAL. The order doesn't matter and I've<br>
checked ERRORLEVEL v. %ERRORLEVEL% (see below).  I don't think it's<br>
related to the batch file which is just a minimal test script. The<br>
issue occurs with every Windows python script I've written that<br>
imports gdal - i.e sys.exit(anything >0) will always set an exit code<br>
of 0 if gdal is imported.  Running python from the command prompt does<br>
the same thing.<br>
<div class="im"><br>
set pycmd=python -c "from osgeo import gdal;import sys;sys.exit(1)"<br>
echo %pycmd%<br>
%pycmd%<br>
</div>if ERRORLEVEL 1 (<br>
    echo ERROR LEVEL is 1 or greater<br>
) ELSE (<br>
    echo ERROR LEVEL is incorrect<br>
)<br>
echo ERROR LEVEL=%ERRORLEVEL%<br>
<br>
<br>
Interestingly, one of the users of my code who originally reported the<br>
issue to me found that that ERRORLEVEL is set correctly in Windows XP.<br></blockquote><div>Yes Luke I made another check exluding MetaGETA imports, the software using GDAL python bindings, an it really seems related to GDAl, at least the GDAL release shipped with MetaGETA.<br>

On my workstation, a Windows XP 32 bit SP3 this is the output:<br><br>Microsoft Windows XP [Versione 5.1.2600]<br>(C) Copyright 1985-2001 Microsoft Corp.<br><br>D:\Appl\MetaGETA>python<br>Python 2.6.4 (r264:75708, Oct 26 2009, 08:23:19) [MSC v.1500 32 bit (Intel)] on win32<br>

Type "help", "copyright", "credits" or "license" for more information.<br>>>> import sys<br>>>> sys.exit(15)<br><br>D:\Appl\MetaGETA>echo %ERRORLEVEL%<br>15<br>

<br>D:\Appl\MetaGETA>python<br>Python 2.6.4 (r264:75708, Oct 26 2009, 08:23:19) [MSC v.1500 32 bit (Intel)] on win32<br>Type "help", "copyright", "credits" or "license" for more information.<br>

>>> import sys<br>>>> from osgeo import ogr<br>>>> sys.exit(15)<br><br>D:\Appl\MetaGETA>echo %ERRORLEVEL%<br>15<br><br>On a Windows 2008 R2 64 bit it doesn't work<br><br>Microsoft Windows [Version 6.1.7601]<br>

Copyright (c) 2009 Microsoft Corporation.  All rights reserved.<br><br>E:\Appl\MetaGETA>python<br>Python 2.6.4 (r264:75708, Oct 26 2009, 08:23:19) [MSC v.1500 32 bit (Intel)] on win32<br>Type "help", "copyright", "credits" or "license" for more information.<br>

>>> import sys<br>>>> sys.exit(15)<br><br>E:\Appl\MetaGETA>echo %ERRORLEVEL%<br>15<br><br>E:\Appl\MetaGETA>python<br>Python 2.6.4 (r264:75708, Oct 26 2009, 08:23:19) [MSC v.1500 32 bit (Intel)] on win32<br>

Type "help", "copyright", "credits" or "license" for more information.<br>>>> import sys<br>>>> from osgeo import ogr<br>>>> sys.exit(15)<br><br>E:\Appl\MetaGETA>echo %ERRORLEVEL%<br>

0<br><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I'll file a ticket in TRAC.<br>
<br></blockquote><div><br>---------------------------------------------------<br>41.95581N 12.52854E<br><br><br><a href="http://www.linkedin.com/in/stefanoiacovella" target="_blank">http://www.linkedin.com/in/stefanoiacovella</a><br>

<br><a href="http://twitter.com/#%21/Iacovellas" target="_blank">http://twitter.com/#!/Iacovellas</a><br></div></div>