posativ / acrylamid

(unmaintained) static blog generator in python with incremental rendering ⛺
http://posativ.org/acrylamid/
Other
277 stars 40 forks source link

ImportError: cannot import name ‘HTMLParseError’ #248

Closed kseistrup closed 8 years ago

kseistrup commented 8 years ago

Acrylamid yields an exception when installed on Python 3.5:

$ acrylamid
'acrylamid.tasks.imprt' ImportError: cannot import name 'HTMLParseError'
Traceback (most recent call last):
  File "/tmp/acrylamid-test/lib/python3.5/site-packages/acrylamid/helpers.py", line 422, in discover
    mod = sys.modules[modname]
KeyError: 'acrylamid.tasks.imprt'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/tmp/acrylamid-test/lib/python3.5/site-packages/acrylamid/helpers.py", line 425, in discover
    mod = imp.load_module(modname, fp, path, descr)
  File "/tmp/acrylamid-test/lib/python3.5/imp.py", line 234, in load_module
    return load_source(name, filename, file)
  File "/tmp/acrylamid-test/lib/python3.5/imp.py", line 172, in load_source
    module = _load(spec)
  File "<frozen importlib._bootstrap>", line 693, in _load
  File "<frozen importlib._bootstrap>", line 673, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 662, in exec_module
  File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
  File "/tmp/acrylamid-test/lib/python3.5/site-packages/acrylamid/tasks/imprt.py", line 32, in <module>
    from acrylamid.lib.html import unescape
  File "/tmp/acrylamid-test/lib/python3.5/site-packages/acrylamid/lib/html.py", line 24, in <module>
    from html.parser import HTMLParser as DefaultParser, HTMLParseError
ImportError: cannot import name 'HTMLParseError'

There is no such error as HTMLParseError in Python 3.5, so perhaps something like this could be an interim solution:

try:
    from html.parser import HTMLParseError
except ImportError as e:
    # HTMLParseError is removed in Python 3.5. Since it can never be
    # thrown in 3.5, we can just define our own class as a placeholder.
    class HTMLParseError(Exception):
        pass
kseistrup commented 8 years ago

Please.

posativ commented 8 years ago

Sorry, the project is unmaintained. Just apply your patch.

kseistrup commented 8 years ago

Fair enough.

Perhaps it would be prudent to state on the project here and on acrylamid's homepage that the project is unmaintained so that people can look for other static site generators.

posativ commented 8 years ago

You're right. I'll update the project's description. You can use a different Python version, though.

kseistrup commented 8 years ago

You can use a different Python version, though.

I can, but I prefer using the default python interpreter of “my” Linux distro, currently v3.5.2. I'd better look around for another blogging engine…

posativ commented 8 years ago

Literally every linux distribution™ ships a package with Python 2 because of dependencies. You can even use virtualenv (also available in many distributions). The blog engine depends on your use case. There is no real allrounder.

kseistrup commented 8 years ago

I know that ArchLinux also ships Python 2.7, but I prefer to not use it when there are alternatives. I'm also aware of virtualenv, but it would still require me to install Python 3.4 to be able to run acrylamid on Python 3, and that “solution” is suboptimal.

I favoured acrylamid partly because it's written in Python, which allows me to contribute with bug reports and pull requests, but I reckon I might have to broaden my horizon a bit.

posativ commented 8 years ago

I'm not currently using my engine and I do not use Python that often anymore. I just expected that Python 3 will no longer introduce breaking changes. Silly me.

kseistrup commented 8 years ago

I agree, they shouldn't have introduced that change in Python 3.5. But they did. Bummer.

posativ commented 8 years ago

I generally would not recommend a project that is that inactive. The project supports many different python libraries, that all changed somewhat and are no longer compatible with Acrylamid. The ecosystem is evolving very fast. I would recommend Pelican, at least it has a huge community.

posativ commented 8 years ago

I've updated the project status. If you find a similar, active project, let me know.

kseistrup commented 8 years ago

:+1: