Newbie stuck - new traceback, "OPML" file attached

26 views
Skip to first unread message

chr...@gmail.com

unread,
Aug 29, 2022, 6:15:29 PM8/29/22
to leo-editor
I haven't seen my first message in the list yet, the forum is probably moderated...
Further tests editing the guilty function call:

 File "C:\Python310\lib\site-packages\leo\plugins\leoOPML.py", line 319, in writeFile
    ok = self.c.fileCommands.write_Leo_file(fileName, 1)

TypeError: FileCommands.write_Leo_file() takes 2 positional arguments but 3 were given

So it works with the fileName only, but the result is not an OPML file, not even XML (see attachment).
leo_test1.opml

Edward K. Ream

unread,
Aug 29, 2022, 6:21:26 PM8/29/22
to leo-editor
On Mon, Aug 29, 2022 at 5:15 PM chr...@gmail.com <chr...@gmail.com> wrote:
I haven't seen my first message in the list yet, the forum is probably moderated...
Further tests editing the guilty function call:

I approved both messages, but I only see this one.

Leo opens leo_test1.opml when I change .opml to .leo.

Please resend your original message. Thanks.

Edward

chr...@gmail.com

unread,
Aug 29, 2022, 8:29:55 PM8/29/22
to leo-editor
Hello Edward,

Well, since my original message has now appeared in the group page, I'll repost only the relevant part, just in case. I also attached here an OPML file done in 5 minutes with OmniOutliner (THE outliner reference, I dare say) on my iPhone and saved as OPML. That's the basic format that will allow Leo to exchange files with any other correctly designed OPML-compatible app/program. It's an old spec, but it now is the way for compatibility of outlines with mobile devices as well.

Other attributes can be added, but since OPML is first and foremost an outline exchange format, Vnodes and Tnodes won't cut it.  You can find the spec at
    http://opml.org/spec2.opml . Jump straight to the paragraph titled "Text Attributes".

You can also look at the source of that webpage and see that between lines 49 and 438, it is indeed pure OPML, which is compatible with Mozilla Firefox and Thunderbird (OPML is used a lot for passing RSS feeds), Microsoft Edge, and most probably Google Chrome too (never used it). The outline on that webpage is two levels deeps, and the divots work in the browser.

Now my original post is made a bit obsolete by the second one -the extra keyword args on lines 321 and 322 of leoOPML.py are not compatible with c.fileCommands.write_Leo_file() - but here it is again:
................................................................................................
Problem
I'm pretty sure I got the leoOPML.py plugin configuration right (file, tree, directives, body panel), but when I type write-opml-file in the mini-buffer (and by the way this procedure seems to be nowhere on leoeditor.com or davy39.github.io/leo-editor/apidoc/leo.plugins.html. Thanks, Google),
I get this:

Traceback (most recent call last):
  File "C:\Python310\lib\site-packages\leo\core\leoKeys.py", line 2521, in callAltXFunction
    func(event)
  File "C:\Python310\lib\site-packages\leo\plugins\leoOPML.py", line 346, in writeOpmlCommand
    c.opmlCommands.writeFile(fileName)


  File "C:\Python310\lib\site-packages\leo\plugins\leoOPML.py", line 319, in writeFile
    ok = self.c.fileCommands.write_Leo_file(

TypeError: FileCommands.write_Leo_file() got an unexpected keyword argument 'outlineOnlyFlag'

 every time, either with my own narrow set of parameter plugins or with the one in leosettings.leo.

I went through the plugin code, tried to remove line 321, but then Tostring=False  became unexpected too. Then I tried to learn about c.filecommands, but I thought it better to join the group and write this.
???

Thanks in advance for help,

Chris
See attachment
Document.opml

tbp1...@gmail.com

unread,
Aug 29, 2022, 10:43:10 PM8/29/22
to leo-editor
Would you explain what you would like to happen?  Do you want to get a Leo outline with the nodes named and indented according to the OPML file?  If so, that should be pretty easy to write a script for even without a plugin (in case it's too hard to get it functioning).

chr...@gmail.com

unread,
Aug 30, 2022, 12:02:50 PM8/30/22
to leo-editor
Well, it's not really "what I want", but what should be, because, again, OPML is an outline exchange format.

With the command "read-opml-file", Leo imports just fine the iPhone-generated "Document.opml" file I attached previously here. Why can't it export it back in the same format  with "write-opml-file" so that I can edit it further on the phone?

The Leo OPML file should be standard so that it could be transmitted back and forth and edited by any Windows, Mac, Linux , IOS, and Android OPML-aware app/program, then returned to Leo for further editing.
I'm talking about only the basic text outline, which is what OPML is about: even clones should be changed into copies before conversion to .opml. A script in Leo could rebuild the cloning after re-import, I guess.
There are many such OPML-capable apps/programs, disk-based or cloud-based: other outliners, mind-mappers, note-takers, to-do listers, task managers, workflow managers, converters, dozens of RSS/Atom feed aggregators and readers, etc. This back -and-forth editing is impossible with the .opml produced by Leo. If it's not OPML, don''t call it OPML.

Scripting .leo or .leojs conversion to true .opml is fine, but impossible on an IOS or Android device because of apps sandboxing.

My usage case: Brainstorming, note-taking, project developpment, writing.
I have a sync folder on all my Windows, macOS, IOS, and Android devices at home, where I work. Outside the home, I carry my iPhone and iPad mini.
With an OPML-compliant Leo, I could create a text-only outline about some project, save it as .opml in the sync folder of my PC. It would get instantly synced to all the other devices. When I go to a meeting or get an email while away, I want to integrate the email text or the meeting notes into the outline, on my iPhone or iPad. The changed outline is automatically transmitted via 5G, and when I get home, I could open it in OPML-compliant Leo, and continue working on it.
This is now possible with OmniOutliner, but only on Apple devices, and most of my workflow is organized around 30 years of Windows use, with complex programs I know like the back of my hand, utilities, batch scripts, registry hacks etc. That is why I need an outline editor on Windows, and why I need OPML, which is the only universal outline file format that can be opened, modified and saved, when the spec (http://opml.org/spec2.opml) is respected.

Very good cloud solutions exist, but just read this: https://workflowy.com/privacy-policy/ and you'll understand why I want a fully private setup.

Chris

P.S. I'm also considering using Leo as a PIM/scrapbook, but that wouldn't require OPML.
Reply all
Reply to author
Forward
0 new messages