Hi,

This is related to bug http://www.lyx.org/trac/ticket/8950 

The problem is the following. Currently, to find python2, LyX:
- checks the python command is a valid python 2 executable
- if so, it just stores that the python command is “python” (otherwise, it 
searches and uses an absolute path - leading to no bug)
- when reading lyxrc, or changing preferences, the PATH might be changed. If 
(and it happens) the first “python” in the PATH is python 3, then LyX breaks 
completely (on OS X, no menu is displayed, nothing happens).

Besides fixing the LyX behavior when python scripts fail, there are two 
solutions:
- ensure that python is an absolute path by directly checking the different 
installed python within PATH: this might break in some very corner case and the 
patch is really trivial (on the bug page). The only corner case is the 
following: python is uninstalled while LyX is running, or the matching python 
is replaced by another one (this can happen);
- use a new lyxrc entry (pythonpath) that could be set in the preferences. This 
can break in the same case.
- recheck the PATH every time it is changed. This breaks in the same case.

The second solution has the advantage of storing the value for future LyX runs. 
It would need to be further enhanced by:
- check each time (or on fail) that the current python is a python2 
installation;
- warn if python2 cannot be found and ask the user to provide a path to a valid 
one.

Latter, those checks could be just to have a valid python2/3 installation. This 
is important given the important role played by python in LyX. 

Benjamin

Reply via email to