When starting a python script within miniconda, the %ERRORLEVEL%
variable is set to 0
, even after an error within the execution.
C:\>call \ProgramData\miniconda\_conda.exe run --live-stream -p C:\PythonEnvironments\######Export python C:\PyScripts\#######DataExport.py %var1% %var2% %var3% %var4% %var5% %var6% %var7% %var8%Starting processGetting token startGetting token doneGetting number of slices startGetting number of slices done. Number of slices: 1Querying data startdf_alldata.columns.string <pandas.core.strings.accessor.StringMethods object at 0x000001DEBDB0D6D0>Querying data doneChecking rowcount startRowcount check not passed. ### Query results in 15664 rows. Dataframe to export only has 8190 rows. Check!ERROR: conda.cli.main_run:execute(49): `conda run python C:\PyScripts\######DataExport.py ############################################################################################### | C:/Transfer/######_Export/Live/#################` failed. (See above for error)C:\>echo %ERRORLEVEL%0
- Should it be <> 0, since there clearly is an error detected?
- Any ideas how to get the error-info?
set --live-stream
leads to a live log of the prints, but not for transporting the error info to %ERRORLEVEL%
.
Removing of call
Even removing call does not change the behavior:
C:\>\ProgramData\miniconda3\_conda.exe run --live-stream -p C:\PythonEnvironments\#####Export python C:\PyScripts\#####DataExport.py %var1% %var2% %var3% %var4% %var5% %var6% %var7% %var8%condaStarting processGetting token startGetting token doneGetting number of slices startGetting number of slices done. Number of slices: 1Querying data startdf_alldata.columns.string: <pandas.core.strings.accessor.StringMethods object at 0x0000026D241280E0>Querying data doneChecking rowcount startRowcount check not passed. ##### Query results in 15664 rows. Dataframe to export only has 8190 rows. Please check!ERROR conda.cli.main_run:execute(49): `conda run python C:\PyScripts\#####DataExport.py ##### C:/Transfer/#####_Export/Live/ #####_#####_#####_conda` failed. (See above for error)C:\>echo %ERRORLEVEL%0
The error itself is provoked to test the transfer of the error to cmd.
System and versions used
Python: 3.11.5
Conda: 24.1.2
Windows Server 2016 Standard
CMD executed with admin-permissions