RhetTbull / macnotesapp

Work with Apple MacOS Notes.app from the command line. Also includes python interface for scripting Notes.app from your own python code.
MIT License
141 stars 6 forks source link

ImportError: lxml.html.clean module is now a separate project lxml_html_clean #45

Closed JonathanDoughty closed 7 months ago

JonathanDoughty commented 7 months ago

Following bothbrew install macnotesapp and brew upgrade macnotesapp if I try notes --help I get

Traceback (most recent call last):
  File "<~>.local/bin/notes", line 5, in <module>
    from macnotesapp.__main__ import cli_main
  File "<~>.local/pipx/venvs/macnotesapp/lib/python3.12/site-packages/macnotesapp/__main__.py", line 3, in <module>
...
    from lxml.html.clean import Cleaner
  File "<~>.local/pipx/venvs/macnotesapp/lib/python3.12/site-packages/lxml/html/clean.py", line 18, in <module>
    raise ImportError(
ImportError: lxml.html.clean module is now a separate project lxml_html_clean.
Install lxml[html_clean] or lxml_html_clean directly.

Web searches suggest this results from a recent spinoff from lxml

because many reports about possible security vulnerabilities were filed for lxml and that make the project problematic for security-sensitive environments

I'd try to provide a PR but my python lacks poetry and pipx.

RhetTbull commented 7 months ago

@all-contributors please add @JonathanDoughty for bug

allcontributors[bot] commented 7 months ago

@RhetTbull

I've put up a pull request to add @JonathanDoughty! :tada:

RhetTbull commented 7 months ago

I didn't even know macnotesapp could be installed via brew. I have tried to replicate this with pip and pipx and it installs fine (it's able to resolve a version of the dependencies that satisfy all constraints).

RhetTbull commented 7 months ago

Should be fixed in v0.6.0.

JonathanDoughty commented 7 months ago

Thanks! tl;dr: I was able to get the revised version working by following the README_DEV.md and running ./build.sh to create dist/notes.zip and then extracting the executable from there, after brew install poetry and poetry install; poetry shell

pytest -v -s tests/ also ran through my existing Notes and created the new test ones so at least I know that part works.

I was NOT able to get it running using pipx: I kept getting 0.5.3 and/or running into python version issues -- looks like I may need to install yet another local python version. This is my first attempt at using pipx so blame it on user error.

FYI: the 0.6.0 release does not include notes.zip whereas the assets for earlier version do. Thanks again!