Could you say more about what you want to accomplish? Maybe there is another way to go about it. Do you really need to open Leo programmatically from another program? For example, you could write some (non-Leo) file with your program, launch Leo (from your program) with that file on the command line, and Leo would open or import that file.
Well, it *used* to but just now when I tested it, you only get a node with the file name (if it's not a .leo file) and no content. I don't know if that is now the intended behavior or not but it's a change. I'm going to file an issue on that. Otherwise, to communicate with Leo requires the Leo bridge or some kind of server like leoserver, but you'd have to write a client for that. But perhaps there is another way to do what you want to end up with. On Thursday, September 7, 2023 at 4:16:56 PM UTC-4 brian wrote: > 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. > > > -- 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/f1be2a9c-4e05-45c5-bed4-6bc5286d5818n%40googlegroups.com.
