assumes "python" command exists

José Abílio Matos jamatos at
Mon Feb 15 10:56:11 UTC 2021

On Monday, February 15, 2021 4:27:40 AM WET Richard Kimberly Heck wrote:
> We have a Python detection routine, find_python_binary(), so it could be
> modified to check for those commands explicitly. I'm reluctant to touch
> that code myself though.

The detection code in LyX is working correctly, it works if the name is not 
python. The code searches for python39 or python3.9 or ...

The issue that Scott is raising is different. The problem is that 
always issue a "python" as the python name. When we get here the lyx detection 
code already worked correctly.

I had thought previously about this and I have an idea to fix this.

import os, sys


so the idea is to replace "python" by os.path.basename(sys.executable) in all 
the calls on

This code is general, since it takes care of the directory separators, and it 
should work everywhere.

Funnily enough the function rescanTeXFiles (line 1920) already does that. :-)

For the next stable release if we assume a minimum of python 3.6 we can use 
the f-strings (formatted in case you wonder :-) ) and the code could be 

python = os.path.basename(sys.executable);

print (f"{python}")

so that the content of variable python is replaced inside the function...
José Abílio
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the lyx-devel mailing list