retext-project / retext

ReText: Simple but powerful editor for Markdown and reStructuredText
GNU General Public License v2.0
1.88k stars 196 forks source link

latext retext won't load, "NameError: name 'locale_encoding' is not defined" #447

Closed eyalroz closed 5 years ago

eyalroz commented 5 years ago

I've just installed retext with pip3 install retext as root on my Devuan ASCII system. All the prerequisites seem to have been in place already. Yet - when I try to run it (/usr/local/bin/retext) I get:

Using configuration file: /home/eyalroz/.config/ReText project/ReText.conf
Traceback (most recent call last):
  File "/usr/bin/retext", line 102, in <module>
    main()
  File "/usr/bin/retext", line 74, in main
    window = ReTextWindow()
  File "/usr/share/retext/ReText/window.py", line 202, in __init__
    availableMarkups = markups.get_available_markups()
  File "/usr/lib/python3/dist-packages/markups/__init__.py", line 57, in get_available_markups
    if markup.available():
  File "/usr/lib/python3/dist-packages/markups/restructuredtext.py", line 33, in available
    import docutils.core
  File "/usr/lib/python3/dist-packages/docutils/core.py", line 20, in <module>
    from docutils import frontend, io, utils, readers, writers
  File "/usr/lib/python3/dist-packages/docutils/frontend.py", line 41, in <module>
    import docutils.utils
  File "/usr/lib/python3/dist-packages/docutils/utils/__init__.py", line 20, in <module>
    import docutils.io
  File "/usr/lib/python3/dist-packages/docutils/io.py", line 18, in <module>
    from docutils.utils.error_reporting import locale_encoding, ErrorString, ErrorOutput
  File "/usr/lib/python3/dist-packages/docutils/utils/error_reporting.py", line 60, in <module>
    codecs.lookup(locale_encoding or '') # None -> ''
NameError: name 'locale_encoding' is not defined

(PS - Devuan ASCII is Debian Stretch without SystemD.)

Why is this happening and how can I fix it? I'm not much of a Python expert, to say the least.

mitya57 commented 5 years ago

This sounds similar to https://sourceforge.net/p/docutils/bugs/321/.

Please try upgrading docutils to version 0.14 or backport this upstream patch: https://sourceforge.net/p/docutils/code/8119/.

eyalroz commented 5 years ago

That solved it, thank you.