As of rev 835218 in devel, the pyzo_in_leo plugin works by using pyzo's
*actual* sources.
To make this work you must do the following:
1. Install pyzo.
2. Put pyzo on your path, such that typing `pyzo` in a console starts pyzo.
I recently discovered the marvelous *find_executable *function in python's
distutils.spawn module. This function has changed how I think about
inter-process communication.
Edward
P.S. Here are some examples showing how to use find_executable...
Here is how Leo communicates with asciidoctor and asciidoc3:
asciidoctor_exec = find_executable('asciidoctor')
asciidoc3_exec = find_executable('asciidoc3')
...
def run_asciidoctor(self, i_path, o_path):
global asciidoctor_exec, asciidoc3_exec
# Call the external program to write the output file.
prog = 'asciidoctor' if asciidoctor_exec else 'asciidoc3'
command = f"{prog} {i_path} -o {o_path} -b html5"
g.execute_shell_commands(command)
And here is how the top-level init function in the pyzo_in_leo plugin
discovers how to import pyzo:
global pyzo
# Fail if can't find pyzo.exe.
pyzo_exec = find_executable('pyzo')
if not pyzo_exec:
return oops('can not find pyzo.exe')
# Add pyzo/source to sys.path
pyzo_dir = os.path.dirname(pyzo_exec)
pyzo_source_dir = os.path.join(pyzo_dir, 'source')
if pyzo_source_dir not in sys.path:
sys.path.insert(0, pyzo_source_dir)
# Fail if still can't import pyzo.
try:
import pyzo as local_pyzo
pyzo = local_pyzo
except ImportError:
return oops(f"can not import pyzo from {pyzo_source_dir!r}")
EKR
--
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/45949d3c-3bbd-4f1b-a91a-c38d1473ce02%40googlegroups.com.