TabViewer / tabview

Python curses command line CSV and tabular data viewer
Other
460 stars 49 forks source link

"name 'locale_encoding' is not defined" when trying to list commands #158

Open eyalroz opened 6 years ago

eyalroz commented 6 years ago

I've cloned and run /setup.py --help-commands, only to get the following:

  File "./setup.py", line 43, in <module>
    keywords=("data spreadsheet view viewer console "
  File "/usr/lib/python2.7/distutils/core.py", line 137, in setup
    ok = dist.parse_command_line()
  File "/usr/lib/python2.7/dist-packages/setuptools/dist.py", line 358, in parse_command_line
    result = _Distribution.parse_command_line(self)
  File "/usr/lib/python2.7/distutils/dist.py", line 464, in parse_command_line
    if self.handle_display_options(option_order):
  File "/usr/lib/python2.7/dist-packages/setuptools/dist.py", line 747, in handle_display_options
    return _Distribution.handle_display_options(self, option_order)
  File "/usr/lib/python2.7/distutils/dist.py", line 669, in handle_display_options
    self.print_commands()
  File "/usr/lib/python2.7/dist-packages/setuptools/dist.py", line 499, in print_commands
    cmdclass = ep.resolve()
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2297, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/usr/lib/python2.7/dist-packages/sphinx/setup_command.py", line 23, in <module>
    from sphinx.application import Sphinx
  File "/usr/lib/python2.7/dist-packages/sphinx/application.py", line 26, in <module>
    from docutils.parsers.rst import convert_directive_function, \
  File "/usr/lib/python2.7/dist-packages/docutils/parsers/rst/__init__.py", line 74, in <module>
    import docutils.statemachine
  File "/usr/lib/python2.7/dist-packages/docutils/statemachine.py", line 113, in <module>
    from docutils import utils
  File "/usr/lib/python2.7/dist-packages/docutils/utils/__init__.py", line 20, in <module>
    import docutils.io
  File "/usr/lib/python2.7/dist-packages/docutils/io.py", line 18, in <module>
    from docutils.utils.error_reporting import locale_encoding, ErrorString, ErrorOutput
  File "/usr/lib/python2.7/dist-packages/docutils/utils/error_reporting.py", line 60, in <module>
    codecs.lookup(locale_encoding or '') # None -> ''

I'm using Devuan 2.0 ASCII. Some potentially-relevant environment variabes:

LANG=en_IL
LANGUAGE=en_IL:en
firecat53 commented 6 years ago

Sorry for the delayed response! I'm guessing there's an issue with the setup of your system's locale. Unfortunately, there's not much I'm going to be able to help with. I use a systemd-based system where all that is handled/set by localectl.

The only thing I can think to try is to edit setup.py and see if a stray bad character somehow got into the keywords list since that's where the error is occurring. I don't see why, as they're all just lower case latin alphabet letters without any special characters other than commas!

eyalroz commented 6 years ago

I disagree, in the sense that "internal" issues should not be exposed like that. An error could be "Can't find expected information about your locale" or "your settings in /etc/xyz are inconsistent with your settings at /etc/abc" - but not some cryptic message about an internal variable that's undefined. That is, more likely than not, a bug somewhere.

However - somehow the issue does not manifest right now (and I'm having another setup issue instead).

firecat53 commented 6 years ago

I don't disagree that programs should typically not dramatically fail on 'internal issues' like that. However, in this case, the error seems to be occurring in the docutils package, not in tabview anywhere. The only tabview code being run by setup.py --help-commands is setup.py...which is a common script for all python packages. I really don't believe this a tabview issue, but I'll keep this open pending more information.