Corrected sys.executable

10-27-2021 01:00 PM
Status: Open
Labels (1)
New Contributor III

sys.executable should work as specified in the Python specification.

A string giving the absolute path of the executable binary for the Python interpreter, on systems where this makes sense. If Python is unable to retrieve the real path to its executable, sys.executable will be an empty string or None.

Source: (emphasis are mine)

sys.executable should be either None or an empty string or C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\python.exe (or the path of the python.exe of the currently used Python environment).

As of today, sys.executable is equals C:\Program Files\ArcGIS\Pro\bin\ArcGISPro.exe when using the ArcGIS Pro built-in Python console or the built-in Notebook feature.

ArcGISPro.exe is obviously not a Python interpreter. 






@Thomas-Zuberbuehler wrote:

ArcGISPro.exe is obviously not a Python interpreter. 

Don't be so sure...


I guess it all comes down how Esri interprets this paragraph:

Embedding Python is similar to extending it, but not quite. The difference is that when you extend Python, the main program of the application is still the Python interpreter, while if you embed Python, the main program may have nothing to do with Python — instead, some parts of the application occasionally call the Python interpreter to run some Python code.

Source: (emphasis are mine)