I’ve written a program that manages media and creates playlists.  It does 
things like download RSS feeds, convert video to audio, sync with my cell 
phone, etc.  

I use Leo to keep notes.  When I find media that I want to add to my Leo 
notes, I manually create the node and put in my notes in the text body.  I 
want to expand my software where in addition to creating playlists, it will 
create a .leo file so that I only have to add my notes.  

I do NOT want to interact with an existing Leo instance.  If I did, I would 
use leoBridge.  I want to create a .leo file that I can open with Leo. 
 Like my program outputs playlists now, I want to output a .leo file that I 
can open with Leo.  

Looking at the API and classes, it would seems it would be possible to 
create a .leo file.  It seems the code base has the core and the GUI in 
different modules.  I like using the API or python classes most since I can 
use my IDE and debugger.  Another option would be to spin up another 
instance of Leo and use the bridge.  Another option would be to have my 
program output the code that I could paste into a leo node to execute.  

I have not considered outputting a format that leo can read directly.  It 
would still be easier to code and debug if I used the Leo API or Leo code 
base.  

On Thursday, September 7, 2023 at 4:57:18 PM UTC-4 tbp1...@gmail.com wrote:

> 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 leo-editor+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/leo-editor/0881910a-0910-4be1-9634-5d37d1eea5d7n%40googlegroups.com.

Reply via email to