> 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/4ea31ed2e0518866
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
I have a project which needs to use python 2.5, which Leo doesn't run
on anymore. The method I use to keep using Leo with this project is to
create a button which opens a shell with the correct python
environment. It's not as quick or smooth as [Ctrl]-[B] to use Leo's
active interpreter, but it helps.
1. create a node "@button pyshell here" in the foobar-project.leo.
Body contents for that node:
-----
@
Open a windows cmd.exe prompt in the path of the currently selected node.
A mapped drive letter will be created for a UNC path.
Adapted from:
http://webpages.charter.net/edreamleo/scripting.html#working-with-directives-and-paths
http://www.mail-archive.com/leo-e...@googlegroups.com/msg12177.html
@c
d = c.scanAllDirectives(p)
# g.es(g.dictToString(d)) #uncomment to show results of above in log pane
#path = d.get('path')
path = c.getNodePath(p)
name = p.anyAtFileNodeName()
if name:
name = g.os_path_finalize_join(path,name)
g.es(name)
from subprocess import Popen
#Popen(r'cmd.exe /k pushd %s' % path)
Popen(r'%s/pyshell.bat' % path)
-----
2. Create pyshell.bat in my foobar-project directory:
-----
@echo off
echo.
echo. Setting environment for python
echo.
set PYTHONHOME=C:\Python25
set PYTHONPATH=%PYTHONHOME%;%PYTHONHOME%\Lib;%PYTHONHOME%\DLLs;C:\ESRI\ArcGIS\Bin
set PATH=%PYTHONHOME%;%path%
set py
python --version
echo.
:: add directory of the pyshell script to PATH
pushd %~dp0
set path=%path%;%~dp0
cmd /k
-----
--
-matt