propy.bat does not preserve python.exe exit code

803
2
04-19-2018 12:56 AM
MadsHoumann
New Contributor II

I need the python.exe exit code to detect if our unit test suite has failed.
But propy.bat (ArcGIS Pro 2.1) does not preserve the exit code from python.exe.

Any ideas for a workaround - or could we maybe see it fixed in a coming release?

0 Kudos
2 Replies
Luke_Pinner
MVP Regular Contributor

Perhaps run your test suite in the arcgispro-py3 conda env (eg using proenv.bat) and call python directly rather than calling propy.bat.

JoshuaBixby
MVP Esteemed Contributor

In propy.bat, try replacing the following

python.exe %*
@call %deactivate_path%

with

python.exe %*
@set pythonerror=%errorlevel%
@call %deactivate_path%
exit /b %pythonerror%