I don't think you can use the changed code without restarting Leo.
I don't think existing commands and menus get updated by closing and re-opening an outline. Commands and Menus created in a settings tree in the outline might update, but I'm not sure about that.
I understand log 003 well enough. The standard-issue Leo install is being executed instead of the one in your clone repo. How do you start Leo normally, e.g., for log 001?
I think the restart-leo command has a weakness - it's going to start Leo using a shell inheriting its owner's environment. If that original environment doesn't include a PYTHONPATH variable or hasn't been cd'ed to the leo-editor directory, it will find the pip-installed version instead of the git version.
I just tried the restart-leo command in one of my Linux VMs. It's also running in a venv. The restart worked as intended. however, I start Leo with the git repo clone version of Leo by using a shell script that firsts sets PYTHONPATH to point to the leo-editor directory in my git repo. Then it sources the venv. So when the restart-leo command runs, the new shell inherits the right environment.If this is right, the command will be unreliable for anyone who doesn't start the original Leo session the "right" way. The user might not even notice they are running the wrong version of Leo.
...
Leo restart on Windows suffers from the same problem. If I start it with my batch file that sets PYTHONPATH, it restarts the git/leo-editor version. If instead I cd to git/leo-editor and start with py -m leo.core.runLeo, then issue restart-leo, the pip-installed version gets started. So it's the same problem on Windows. It's just easy to overlook. OTOH, if I start Leo with the launchLeo.py script, the restart-leo command works as intended (only tested on Linux so far). Very mysterious.
I have created a GitHub issue, so this restriction is not forgotten.
Leo restart on Windows suffers from the same problem. If I start it with my batch file that sets PYTHONPATH, it restarts the git/leo-editor version. If instead I cd to git/leo-editor and start with py -m leo.core.runLeo, then issue restart-leo, the pip-installed version gets started.
Leo restart on Windows suffers from the same problem. If I start it with my batch file that sets PYTHONPATH, it restarts the git/leo-editor version. If instead I cd to git/leo-editor and start with py -m leo.core.runLeo, then issue restart-leo, the pip-installed version gets started.
I thinks [the restart-leo command] is correct and I don't want to change this logic!
On Friday, October 18, 2024 at 4:23:21 AM UTC-5 viktor....@gmail.com wrote:Leo restart on Windows suffers from the same problem. If I start it with my batch file that sets PYTHONPATH, it restarts the git/leo-editor version. If instead I cd to git/leo-editor and start with py -m leo.core.runLeo, then issue restart-leo, the pip-installed version gets started.I've just taken another look at 'restart-leo'.After shutting down Leo, the command begins the restart process like this:os.chdir(g.app.initial_cwd) # The directory from which Leo started.
- What ( else ) is needed to convince you that there is an issue ?
I'll take a break for a while ! - I have provided all the information I have in my previous postings ...
I have tracked down what is happening but I don't know why. The problem is not with the restart command, it's with the runLeo.py module. It runs a different version of Leo, and even a different version of Python, depending on how it is invoked even though you would swear the results should be the same. Details are in the issue I just filed:
I have tracked down what is happening but I don't know why. The problem is not with the restart command, it's with the runLeo.py module. It runs a different version of Leo, and even a different version of Python, depending on how it is invoked even though you would swear the results should be the same. Details are in the issue I just filed:The reason that this problem has been showing up with the restart-leo command is that the launch command that is captured by sys.argv is NOT always that same command that launched Leo in the first place. The case that occurs for me is that I launch Leo usingpy -m leo.core.runLeo
On Tue, Nov 19, 2024 at 4:21 PM Thomas Passin wrote:I have tracked down what is happening but I don't know why. The problem is not with the restart command, it's with the runLeo.py module. It runs a different version of Leo, and even a different version of Python, depending on how it is invoked even though you would swear the results should be the same. Details are in the issue I just filed:The reason that this problem has been showing up with the restart-leo command is that the launch command that is captured by sys.argv is NOT always that same command that launched Leo in the first place. The case that occurs for me is that I launch Leo usingpy -m leo.core.runLeoBingo!My local leo.cmd is:python C:\Repos\leo-editor\launchLeo.py %*This tells python exactly where to find Leo's repo. In contrast, py -m leo.core.runLeo does not.Unless I am mistaken, this difference explains:
- All the behaviour you describe.- The reason I have never seen the behaviors you describe.DiscussionUsing python -m is often correct, so the choice will always be a tripper.
I use this local file, run-installed-leo.cmd, during testing, as discussed in the distribution checklist:
rem Do **NOT** run this script from the leo-editor folder.
rem pip must *not* find the leo-editor folder!
cd c:\Repos
call python -m leo-editor.leo.scripts.run_installed_leo
cd c:\Repos\leo-editorIn this script, python -m is correct.A similar tripper?I am having a devil of a time with #4179: use a dark theme for Leo's website.Single-stepping through the `@button make-sphinx` script in LeoDocs.leo showed mismatches between python.exe and the sphinx libs! I'm still investigating.
I did notice an unexpected venv folder in my python folder. I foolishly ignored that surprise at the time, but I'll get back to that mystery soon enough.Summarypy -m may have unexpected consequences that will bite devs especially.HTH. Please let me know whether this post solves the mystery for you.
I do not believe a word of your analysis. There is something wrong with your installation.
I do not believe a word of your analysis. There is something wrong with your installation.Then you had better think again.1. The exact same behavior happens on my Linux EndeavourOS VM. I just checked it.2. My statement that the starting argument of -m leo.core.runLeo gets changed in sys.argv to leo\core\runLeo is a fact.
Summarypython -m leo.core.runLeo works as expected from all locations.restart-leo works as expected at all times.Edward
Let's continue this investigation on the GitHub issue thread, shall we?
I agree that py -m leo.core.runLeo works as expected in all the cases. My tests all show the same. What doesn't work as expected is running py leo\core\runLeo.py when the working directory is leo-editor.