Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problems with error messages containing non-ASCII #51

Open
Marrin opened this issue Apr 3, 2014 · 4 comments
Open

Problems with error messages containing non-ASCII #51

Marrin opened this issue Apr 3, 2014 · 4 comments

Comments

@Marrin
Copy link

Marrin commented Apr 3, 2014

Simple test case:

# coding: utf8
# TODO Comment with non ASCII characters in it: °C.

This does not show up in the status line and invoking the list of all warnings doesn't work any more.

When moving the cursor onto that line the Sublime Text console reads:

Traceback (most recent call last):
  File "./sublime_plugin.py", line 200, in on_selection_modified
  File "./sublime_plugin.py", line 154, in run_timed_function
  File "./sublime_plugin.py", line 199, in <lambda>
  File "./pylinter.py", line 577, in on_selection_modified
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc2 in position 53: ordinal not in range(128)

And when trying to invoke the list of all Pylint messages with Ctrl+Alt+C the console contains:

Traceback (most recent call last):
  File "./sublime_plugin.py", line 356, in run_
  File "./pylinter.py", line 283, in run
  File "./pylinter.py", line 373, in popup_error_list
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc2 in position 53: ordinal not in range(128)
@eskin
Copy link

eskin commented Oct 5, 2014

Traceback (most recent call last):
  File "/usr/local/lib/python3.4/site-packages/astroid/manager.py", line 163, in file_from_module_name
    value = self._mod_file_cache[(modname, contextfile)]
KeyError: ('sqlite3.dbapi2', None)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.4/site-packages/pylint/lint.py", line 626, in get_ast
    return MANAGER.ast_from_file(filepath, modname, source=True)
  File "/usr/local/lib/python3.4/site-packages/astroid/manager.py", line 106, in ast_from_file
    return AstroidBuilder(self).file_build(filepath, modname)
  File "/usr/local/lib/python3.4/site-packages/astroid/builder.py", line 134, in file_build
    return self._post_build(module, encoding)
  File "/usr/local/lib/python3.4/site-packages/astroid/builder.py", line 156, in _post_build
    self.delayed_assattr(delayed)
  File "/usr/local/lib/python3.4/site-packages/astroid/builder.py", line 206, in delayed_assattr
    for infered in node.expr.infer():
  File "/usr/local/lib/python3.4/site-packages/astroid/bases.py", line 313, in wrapped
    for res in _func(node, context, **kwargs):
  File "/usr/local/lib/python3.4/site-packages/astroid/bases.py", line 115, in _infer_stmts
    for infered in stmt.infer(context):
  File "/usr/local/lib/python3.4/site-packages/astroid/bases.py", line 313, in wrapped
    for res in _func(node, context, **kwargs):
  File "/usr/local/lib/python3.4/site-packages/astroid/bases.py", line 115, in _infer_stmts
    for infered in stmt.infer(context):
  File "/usr/local/lib/python3.4/site-packages/astroid/bases.py", line 313, in wrapped
    for res in _func(node, context, **kwargs):
  File "/usr/local/lib/python3.4/site-packages/astroid/bases.py", line 337, in wrapper
    for node in func(*args, **kwargs):
  File "/usr/local/lib/python3.4/site-packages/astroid/inference.py", line 190, in infer_callfunc
    for callee in self.func.infer(context):
  File "/usr/local/lib/python3.4/site-packages/astroid/bases.py", line 313, in wrapped
    for res in _func(node, context, **kwargs):
  File "/usr/local/lib/python3.4/site-packages/astroid/bases.py", line 337, in wrapper
    for node in func(*args, **kwargs):
  File "/usr/local/lib/python3.4/site-packages/astroid/inference.py", line 242, in infer_getattr
    for owner in self.expr.infer(context):
  File "/usr/local/lib/python3.4/site-packages/astroid/bases.py", line 313, in wrapped
    for res in _func(node, context, **kwargs):
  File "/usr/local/lib/python3.4/site-packages/astroid/bases.py", line 115, in _infer_stmts
    for infered in stmt.infer(context):
  File "/usr/local/lib/python3.4/site-packages/astroid/bases.py", line 313, in wrapped
    for res in _func(node, context, **kwargs):
  File "/usr/local/lib/python3.4/site-packages/astroid/inference.py", line 210, in infer_import
    yield self.do_import_module(self.real_name(name))
  File "/usr/local/lib/python3.4/site-packages/astroid/mixins.py", line 105, in do_import_module
    return mymodule.import_module(modname, level=level)
  File "/usr/local/lib/python3.4/site-packages/astroid/brain/py2gi.py", line 126, in _new_import_module
    return _orig_import_module(self, modname, relative_only, level)
  File "/usr/local/lib/python3.4/site-packages/astroid/scoped_nodes.py", line 356, in import_module
    return MANAGER.ast_from_module_name(absmodname)
  File "/usr/local/lib/python3.4/site-packages/astroid/manager.py", line 135, in ast_from_module_name
    return self.ast_from_file(filepath, modname, fallback=False)
  File "/usr/local/lib/python3.4/site-packages/astroid/manager.py", line 106, in ast_from_file
    return AstroidBuilder(self).file_build(filepath, modname)
  File "/usr/local/lib/python3.4/site-packages/astroid/builder.py", line 134, in file_build
    return self._post_build(module, encoding)
  File "/usr/local/lib/python3.4/site-packages/astroid/builder.py", line 153, in _post_build
    self.add_from_names_to_locals(from_node)
  File "/usr/local/lib/python3.4/site-packages/astroid/builder.py", line 190, in add_from_names_to_locals
    imported = node.do_import_module()
  File "/usr/local/lib/python3.4/site-packages/astroid/mixins.py", line 105, in do_import_module
    return mymodule.import_module(modname, level=level)
  File "/usr/local/lib/python3.4/site-packages/astroid/brain/py2gi.py", line 126, in _new_import_module
    return _orig_import_module(self, modname, relative_only, level)
  File "/usr/local/lib/python3.4/site-packages/astroid/scoped_nodes.py", line 356, in import_module
    return MANAGER.ast_from_module_name(absmodname)
  File "/usr/local/lib/python3.4/site-packages/astroid/manager.py", line 123, in ast_from_module_name
    filepath = self.file_from_module_name(modname, context_file)
  File "/usr/local/lib/python3.4/site-packages/astroid/manager.py", line 167, in file_from_module_name
    context_file=contextfile)
  File "/usr/local/lib/python3.4/site-packages/astroid/modutils.py", line 275, in file_from_modpath
    return _file_from_modpath(modpath, path, context)
  File "/usr/local/lib/python3.4/site-packages/astroid/modutils.py", line 482, in _file_from_modpath
    mtype, mp_filename = _module_file(modpath, path)
  File "/usr/local/lib/python3.4/site-packages/astroid/modutils.py", line 603, in _module_file
    data = stream.read(4096)
  File "/usr/local/Cellar/python3/3.4.1_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/encodings/ascii.py", line 26, in decode
    return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 80: ordinal not in range(128)

@eskin
Copy link

eskin commented Oct 5, 2014

$ pylint --version
No config file found, using default configuration
pylint 1.3.1, 
astroid 1.2.1, common 0.62.1
Python 3.4.1 (default, Sep 17 2014, 22:44:15) 
[GCC 4.2.1 Compatible Apple LLVM 5.1 (clang-503.0.40)]

if i run some command, what runs the Pylinter, then pylint exec ok

@eskin
Copy link

eskin commented Oct 5, 2014

When i run Sublime from OSX Dock, in Sublime console:

>>> import locale; print(locale.getdefaultlocale());
(None, None)

but, if i run it from console - then it's ok! And Pylinter works fine!

@Marrin
Copy link
Author

Marrin commented Aug 17, 2017

This seems to be solved‽

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants