leo-to-html HAS STOPPED WORKING

74 views
Skip to first unread message

chr...@gmail.com

unread,
May 13, 2024, 12:35:09 PM5/13/24
to leo-editor
...and it's a major-urgent-pain-in-the-neck for me!

- None of the plugin submenus appear in the File > Export Files... menu
- The plugin is correctly enabled in myLeoSettings.leo
- There is no "@bool leo_to_html_no_menus = True" anywhere

- I have a  ~450 headlines outline, so I tried with a 3-line
"test1"
"test2"-"test3" outline, here is what I get by running
"export-html-bullet" from the minibuffer:
Leo Log Window
Leo 6.7.7
Python 3.11.8, PyQt version 5.15.2
Windows 10 AMD64 (build 10.0.19045) SP0
leo_to_html: running ...
Traceback (most recent call last):
  File "C:\leo-editor-master\leo\core\leoKeys.py", line 2501, in callAltXFunction
    func(event)
  File "C:\leo-editor-master\leo\plugins\leo_to_html.py", line 248, in export_html_head
    self.export_html(bullet='head')
  File "C:\leo-editor-master\leo\plugins\leo_to_html.py", line 236, in export_html
    html.main(bullet=bullet, show=show, node=node)
  File "C:\leo-editor-master\leo\plugins\leo_to_html.py", line 453, in main
    self.do_xhtml(node)
  File "C:\leo-editor-master\leo\plugins\leo_to_html.py", line 353, in do_xhtml
    self.doItemHeadlineTags(root)
  File "C:\leo-editor-master\leo\plugins\leo_to_html.py", line 373, in doItemHeadlineTags
    self.doHeadline(p, level)
  File "C:\leo-editor-master\leo\plugins\leo_to_html.py", line 408, in doHeadline
    self.xhtml.append(self.openHeadlineString % h + headline + self.closeHeadlineString % h)
    ^^^^^^^^^^
AttributeError: 'Leo_to_HTML' object has no attribute 'xhtml'

same result with "export-html-head"

- The Toolbar Menu -> Plugins ->Properties results in this in the log window:
Properties menu not supported for Qt gui

"export-html-node" doesn't work either.

HELP!






Thomas Passin

unread,
May 13, 2024, 1:21:21 PM5/13/24
to leo-editor
I don't know why it's not working, but I do know why the submenus aren't appearing.  It's because the plugin is trying to add its own menus under the File/Export... menu.  But that's been renamed and is now File/Export Files.  The plugin code will have to change to match that name.  Even better would be for the plugin to insert its own menu item with its submenus.  Then it won't fail the next time there's a menu name change.

What is the latest release where you know it worked?

Thomas Passin

unread,
May 13, 2024, 4:06:29 PM5/13/24
to leo-editor
I have created a pull request, 3907, that gets this plugin working again.  At least, it works when outputting just the headlines.  I haven't tested it including all the body text.  But I think it should work as it did before.

As for that Properties submenu in the Plugins menu, that's not going to work until someone is able to put in a lot of work to make it function in Qt (it's a holdover from the Tk  Gui days, apparently).  But you can still set those properties by hand in the .ini file leo-to-html.ini, as before.

If anyone wants to try it out before the PR gets merged into the devel branch, you can follow the link in the Github PR page to my repository and get the file there.

chr...@gmail.com

unread,
May 13, 2024, 5:42:58 PM5/13/24
to leo-editor
What is the latest release where you know it worked?

Maybe November, not sure at all.

Thomas Passin

unread,
May 13, 2024, 5:43:32 PM5/13/24
to leo-editor
This PR has been merged into the devel branch, if you need it before the next general release of Leo.

chr...@gmail.com

unread,
May 13, 2024, 5:48:26 PM5/13/24
to leo-editor
On Monday, May 13, 2024 at 8:06:29 PM UTC tbp1...@gmail.com wrote:
I have created a pull request, 3907, that gets this plugin working again.  At least, it works when outputting just the headlines.

If anyone wants to try it out before the PR gets merged into the devel branch, you can follow the link in the Github PR page to my repository and get the file there.

Thanks Thomas, I half understand "Github PR page to my repository"... is the name of the file LEO-TO-HTML.? and do I replace the same file in my installation?

chr...@gmail.com

unread,
May 13, 2024, 5:53:48 PM5/13/24
to leo-editor
OK, found it

Thomas Passin

unread,
May 13, 2024, 6:06:08 PM5/13/24
to leo-editor
Yes, once you find the leo-to-html.py file, download it and then copy into your Python install's site-packages/leo/plugins directory.

To find that location, open a terminal or console and run

py -m pip show leo

NOTE - use the actual command that you use to run Python if it's not "py".  The response will include a line that tells you where the right site-packages directory is.  On my system it's

Location: C:\Users\tom\AppData\Roaming\Python\Python312\site-packages

Here's a step-by-step now that's in the main Leo-Editor repository.  First, navigate to the top of the repo. Select the Code tab if it's not selected. Then select the devel branch in the branch selector box, near the upper left.  Then navigate to leo/plugins page and scroll down until you find the link to our file, leo-html.py.  Click that link.
In  that page, the one for our file,  notice near the upper right that there is a box labeled "Raw".  There is a download icon next to it.  Click that to download our file.

Please post about any apparent bugs you find - I haven't given this fix much of a workout.  I hoped to get you running as quickly as possible since you sounded as if you depend a lot on the plugin.

chr...@gmail.com

unread,
May 13, 2024, 6:33:18 PM5/13/24
to leo-editor
OK,  so that's why it wouldn't work: I copied it in C:\leo-editor-master\leo\plugins\
I don't even know the difference betweenl eo-editor-master and  the install that's in Python site-packages. I'MM A SELF-TAUGHT GUY except for one semester of BASIC on Apple 2 around 1982, fer chrissakes. But I did surf the wave all along, and among other things I even learned C in a week and wrote an online financial datafeed custom on-demand retrieval program for UBS in the early 90s, in another two weeks, dammit.
Only ever used Github to download useful stuff. I couldn't find how to download the plugin so I copied the text, and of course the first time it wasn't fully expanded.
Gonna try what you wrote now.

Thomas Passin

unread,
May 13, 2024, 7:37:11 PM5/13/24
to leo-editor
On Monday, May 13, 2024 at 6:33:18 PM UTC-4 chr...@gmail.com wrote:
OK,  so that's why it wouldn't work: I copied it in C:\leo-editor-master\leo\plugins\
I don't even know the difference betweenl eo-editor-master and  the install that's in Python site-packages.

I assumed that you were trying to use it with the latest Leo release, the one you get by installing it with pip. If you have a copy or clone of the whole Leo repository you have to make sure that Python will use that one instead.  There are various ways to do that.  At any rate, the command I gave you earlier will tell you where the thing is actually living.

chr...@gmail.com

unread,
May 13, 2024, 8:18:56 PM5/13/24
to leo-editor
OK, it WORKS.
My correct path was indeed C:\leo-editor-master\leo\plugins\, and I now remember that what's in 
C:\Python311\Lib\site-packages\leo-6.7.7.dist-info\
(NOT \leo) is a bunch of stuff that I guessed was like pointing to the actual source directory (leo-editor-master). I downloaded the plugin file following your instructions, and the file had a couple hundred bytes less than my clumsy cut-and-paste of the code. I should have thought of looking up the code of leo_to_html.py: I had noticed the difference of menu name  in its doc and could have fixed it, but without a complete, deep, well-organized documentation, to the non-advanced-IT-professional Leo is such a black box that the idea didn't cross my mind.

THANK YOU SO MUCH THOMAS! I got the job done just as my nightly backups started, ruthlessly hogging the CPU of the laptop I was using.

By the way, several other plugins don't work anymore. I forgot which ones.

The "outside of the python directory" LEO-EDITOR-MASTER trick is a very good one. It makes updating both python and Leo sources much easier, without having to create environments etc. It seems to have disappeared from the "downloading Leo" webpage, though. There was a "downloading sources" section, and I always assumed that the other download methods were providing a kind of half "compiled' Leo, so I never used them. Is that the case? now the whole sources package can be downloaded from github, I guess.

"Leo is a PIM" is not really true anymore.
Without the whole professional programmer's knowledge of all the intricacies of  process and online platforms such as github and all the extra software used to put together and install something like Leo, the guy like me for whom computers are first and foremost (addictive) tools to achieve other things, Leo's complexity has evolved so much that it is now only a great tool for programmers.

I'm planning to go back to OmniOutliner: I'll have my outlines (with pictures) on my Mac, on my PCs through Teamviewer, and on my iPad and iPhone without having to convert them to OPML with a script. I won't have to go through reams of scattershot documentations at every turn of the road.

It was an interesting adventure...

Ciao!
On Monday, May 13, 2024 at 10:06:08 PM UTC tbp1...@gmail.com wrote:

Thomas Passin

unread,
May 14, 2024, 1:06:00 AM5/14/24
to leo-editor

On Monday, May 13, 2024 at 8:18:56 PM UTC-4 chr...@gmail.com wrote:
OK, it WORKS.
...
THANK YOU SO MUCH THOMAS! I got the job done just as my nightly backups started, ruthlessly hogging the CPU of the laptop I was using.
 
Glad I could help!
 
By the way, several other plugins don't work anymore. I forgot which ones.

There are quite a few, actually.  Some never got updated for Qt, and some weren't updated for Qt6.  Their original authors haven't thought to see if they work (maybe they have moved on and don't use the plugin any more).  In some cases, the plugins may have been subjected to some enhancement, usually adding type hints, that ended up changing some variable or property such that the code no longer worked.  There are still (I'm pretty sure) old plugins that were written for Python2 and never updated.

No one is interested in working through all of them and getting them working.  Who wants to spend time figuring out how a plugin works that one doesn't want to use anyway, especially if using it is complex and hard to understand?  In the case of leo-to-html, I got curious to see if it did something I'd like, and when I looked at it, the code and operation seemed fairly simple, so I spent the time for you.
 
The "outside of the python directory" LEO-EDITOR-MASTER trick is a very good one. It makes updating both python and Leo sources much easier, without having to create environments etc. It seems to have disappeared from the "downloading Leo" webpage, though. There was a "downloading sources" section, and I always assumed that the other download methods were providing a kind of half "compiled' Leo, so I never used them. Is that the case? now the whole sources package can be downloaded from github, I guess.

Nowadays the equivalent would be the leo-editor directory, which is above the leo directory in the repository.  You get it if you clone the repo.
Reply all
Reply to author
Forward
0 new messages