First apologies for slow reply - been away. Second massive thanks to Felix 
and Thomas - I'm now well on my way. I was pointing the Leo Editor Path to 
too deep a directory, this is now working fine. I'm not going to worry 
about error messages for the moment but instead try and get my head round 
Leo in VSCode. Thomas I'm reading your note about modules and paths - I 
feel I need to understand this better to make headway. I have to say I 
found path setting on the Amiga more intuitive, those were the days.  Again 
many thanks for taking the time, LeoInteg is a thing of beauty!  IH

On Thursday, 24 August 2023 at 05:42:51 UTC+1 [email protected] wrote:

> On Wednesday, August 23, 2023 at 9:01:46 PM UTC-4 Félix wrote:
>
> Also, i don't know what "-m" does after "py", but since it worked, then 
> perhaps the python command you should put in is "py -m" .
>
>
> This is something that everyone should learn.  The -m  flag means to run 
> the parameter as a module.  Pip can be run as a python program but also as 
> a python module.  So py -m pip ...  Basically, any module that will 
> execute when imported can be started this way.  Why invoke a program this 
> way? 
>
> 1. You automatically get the right version for the Python executable you 
> are running.  For example, if you have both Python 3.9 and 3.11 installed, 
> a bare py will run the latest install, in this case Python 3.11.  With 
> the -m flag, this executable will look for a "pip" module in its own 
> pythonpath.  OTOH, if you just tried to run pip as a program or script,  
> you might get the version installed for Python 3.9.  It all depends on how 
> the paths were set up on your system during installation.  Using py -m 
> guarantees 
> getting the right one.
>
> Similarly, running Leo with py -m leo.core.runLeo guarantees you will get 
> the Leo installation that goes with Python3.11 (in this example).  You can 
> invoke other Python installed versions, even Python 2.x versions, with the 
> *py* launcher by specifying them as command line parameters.
>
> If you set the PYTHONPATH environmental variable, for example to 
> *git/leo-editor* if you have cloned the Leo distro, its location will 
> come first on the pythonpath and code from that location will be loaded 
> first.  That's how I can run Leo from my clone or from the pip-installed 
> version depending on whether I have set PYTHONPATH.
>
> 2. If a program can be run as a module (and is on the pythonpath) you 
> don't need to know where on the disk it's located.  You do need to know the 
> module path, but that's usually easier to find or learn about.  In this 
> case, IH wanted to run leoserver.py, which is in Leo's *leo/core* 
> directory. This file can be run as a module (you can just try it to see if 
> it works), so we don't have to remember and type its full path, or start 
> from the right directory.  We just type py -m leo.core.leoserver (*without 
> the ".py"*).
>
> For LeoInteg, you don't need to include *-m* in the startup setting.  You 
> do need to give the "Leo-Editor Path" and it should be the directory 
> immediately under which the "leo" directory exists. For my git clone of 
> Leo, that is *C:\Tom\git\leo-editor.  *Currently I leave the* "*Python 
> Command" box empty and everything is working.
>
> Hope this helps someone!
>

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/leo-editor/3628e352-4ef3-4b15-914b-7fa954ef1e35n%40googlegroups.com.

Reply via email to