Thank you Terry to point me to this thread. Interesting discussion. In French, we say "Un homme averti en vaut deux" Meaning you feel better when forwarned. Cheers, Rene
On Apr 11, 3:39 pm, Terry Brown <[email protected]> wrote: > On Mon, 11 Apr 2011 06:08:15 -0700 (PDT) > > RAH <[email protected]> wrote: > > Dear All, > > > As I haven't yet totalled 24 hours work of LEO, it took me a while to > > understand what was happening (a program working yesterday and not > > anymore today ?!). My understanding is as below. If I'm wrong please > > correct it. > > > 1) directories and path for LEO: > > They are driven by the @path directive of LEO and have nothing to do > > with the directories or paths known to Python. > > > 2) directories and path for Python: > > They are known to Python and have nothing to do with the LEO path. > > This thread: > > http://groups.google.com/group/leo-editor/browse_thread/thread/4ea31e... > > ended with a decision to make the execution directory fixed relative to > Leo's install directory (or the .leo directory) or some such, taking > into account any @path modifications. Not sure if it actually happened > though. > > Cheers -Terry > > > So far so good. But, where one needs to pay attention is when running > > a Python script within LEO (typing CTRL-B on a node executes the > > script contained in the body of that node). The Python that runs the > > script is the same as the Python running LEO. It is not another > > instance. This means that if you test a script A, then a script B, > > then script A again, the script B might change the Python environment, > > e.g. os.chdir("newdir"), so that script A won't run anymore. e.g. when > > refering to a relative path (./folder/myfile). All the scripts ran > > within LEO use the same instance of Python as LEO does. > > > One way to see what is happening is to write 2 nodes in a brand new > > workbook.leo > > Node A contains: > > import os > > print os.getcwd() > > Node B contains: > > import os > > os.chdir("newdir") > > > Successively select Node A, node B, node A and each time execute the > > script (CTRL-B) and you will see. > > This is different from Idle where each time you execute a script (F5) > > a "new shell" is reloaded. > > > Regards, Rene -- You received this message because you are subscribed to the Google Groups "leo-editor" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/leo-editor?hl=en.
