How do I create a Leo outline from within a Python program? I have a Python program where I want to export into a Leo outline format file.
All the snippets of code I’ve found assumes the code is running within Leo. I want to run outside LEO
I tried this:
from leo.core import leoGlobals as leo_g
from leo.core import leoApp
leo_g.app = leoApp.LeoApp()
leo_c = leo_g.app.newCommander(‘test.leo’)
But I got the exception NoneType object has no attribute ‘globalSettingsDict’
I also tried:
from leo.core.loeGlobals import createScratchCommander
c = createScratchCommander(‘test.leo’)
I got the same error.
I found the “mod_read_dir_outline.py” plugin but it seems to be written to work within Leo.
I found a post about “web-to-outline script” (https://groups.google.com/g/leo-editor/c/CkS8MLRStsA/m/7xbIowG9BAAJ) but I could not find this script.
I also found LeoBridge to interface with an existing instance of Leo but I just want to create an leo outline in another program and then manually open the file with Leo. I don't want to risk corrupting an existing leo file.