Skip to content

Pylint displays E0001 error code while importing packages. Code functions. #3270

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

Closed
linusjf opened this issue Nov 23, 2019 · 9 comments
Closed
Labels
Needs reproduction 🔍 Need a way to reproduce it locally on a maintainer's machine

Comments

@linusjf
Copy link

linusjf commented Nov 23, 2019

Arch Linux on Termux:

$ pylint --version
pylint 2.3.1
astroid 2.2.5
Python 3.8.0 (default, Nov 14 2019, 15:41:40)
[GCC 8.3.0]

Termux:
$ pylint --version
pylint 2.3.1
astroid 2.2.5
Python 3.8.0 (default, Nov 20 2019, 20:44:46)
[Clang 8.0.7 (https://android.googlesource.com/toolchain/clang b55f2d4ebfd35bf6

import random
throws an error with code E0001 when used in python source.

(Should this be a pylint issue or should I post it on the Github projects for Termux and/or ArchLinux for Termux?)

#2976 (comment)

@PCManticore
Copy link
Contributor

Can you post the exact file that triggers this exception as well as the output? There must be something amiss especially since random is a stdlib package and pylint should find that without issues.

@PCManticore PCManticore added the Needs reproduction 🔍 Need a way to reproduce it locally on a maintainer's machine label Nov 25, 2019
@linusjf
Copy link
Author

linusjf commented Nov 25, 2019 via email

@linusjf
Copy link
Author

linusjf commented Nov 27, 2019

Updated with error.
Similar error running it on ArchLinux for Termux.

�[7;33m************* Module namedtuple�[0m
Newbies/namedtuple.py:3:0: E0001: �[1;31mCannot import 'collections' due to syntax error 'invalid syntax (<unknown>, line 96)'�[0m (�[1;31msyntax-error�[0m)
Traceback (most recent call last):
  File "/usr/lib/python3.8/site-packages/astroid/__init__.py", line 91, in _inference_tip_cached
    return iter(_cache[func, node])
KeyError: (<function infer_named_tuple at 0x7f88d72d30>, <Call l.5 at 0x7f888f4910>)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/bin/pylint", line 10, in <module>
    sys.exit(run_pylint())
  File "/usr/lib/python3.8/site-packages/pylint/__init__.py", line 20, in run_pylint
    Run(sys.argv[1:])
  File "/usr/lib/python3.8/site-packages/pylint/lint.py", line 1628, in __init__
    linter.check(args)
  File "/usr/lib/python3.8/site-packages/pylint/lint.py", line 943, in check
    self._do_check(files_or_modules)
  File "/usr/lib/python3.8/site-packages/pylint/lint.py", line 1075, in _do_check
    self.check_astroid_module(ast_node, walker, rawcheckers, tokencheckers)
  File "/usr/lib/python3.8/site-packages/pylint/lint.py", line 1158, in check_astroid_module
    walker.walk(ast_node)
  File "/usr/lib/python3.8/site-packages/pylint/utils.py", line 1303, in walk
    self.walk(child)
  File "/usr/lib/python3.8/site-packages/pylint/utils.py", line 1303, in walk
    self.walk(child)
  File "/usr/lib/python3.8/site-packages/pylint/utils.py", line 1300, in walk
    cb(astroid)
  File "/usr/lib/python3.8/site-packages/pylint/checkers/base.py", line 1747, in visit_assignname
    if isinstance(utils.safe_infer(assign_type.value), astroid.ClassDef):
  File "/usr/lib/python3.8/site-packages/pylint/checkers/utils.py", line 1065, in safe_infer
    inferit = node.infer(context=context)
  File "/usr/lib/python3.8/site-packages/astroid/node_classes.py", line 348, in infer
    return self._explicit_inference(self, context, **kwargs)
  File "/usr/lib/python3.8/site-packages/astroid/__init__.py", line 93, in _inference_tip_cached
    result = func(*args, **kwargs)
  File "/usr/lib/python3.8/site-packages/astroid/brain/brain_namedtuple_enum.py", line 173, in infer_named_tuple
    rename = next(call_site.infer_argument(func, "rename", context)).bool_value()
  File "/usr/lib/python3.8/site-packages/astroid/arguments.py", line 160, in infer_argument
    if len(self.positional_arguments) > len(funcnode.args.args):
TypeError: object of type 'Uninferable' has no len()

@linusjf
Copy link
Author

linusjf commented Dec 4, 2019

termux/termux-packages#4612 (comment)

Closing bug. Fixed via Termux support.

@linusjf linusjf closed this as completed Dec 4, 2019
@linusjf linusjf reopened this Dec 4, 2019
@linusjf
Copy link
Author

linusjf commented Dec 4, 2019

On installing prospector via pip , I was able to reproduce the error importing the modules once more.

I receive the following error when installing pylint after installing prospector:

ERROR: prospector 1.1.7 has requirement astroid==2.2.5, but you'll have astroid 2.3.3 which is incompatible.
ERROR: prospector 1.1.7 has requirement pylint==2.3.1, but you'll have pylint 2.4.4 which is incompatible.

I then have DistributionNotFound errors while running prospector.

@linusjf
Copy link
Author

linusjf commented Dec 4, 2019

Do I need to open a separate bug on Prospector or will you do the needful?

@PCManticore
Copy link
Contributor

Sorry I'm not entirely sure how to reproduce this error, so feel free to report a bug on Propsector side as well.

@linusjf
Copy link
Author

linusjf commented Dec 4, 2019 via email

@linusjf
Copy link
Author

linusjf commented Dec 5, 2019

pip install prospector==1.2.0.dev3
is the solution for now. Closing this issue.

@linusjf linusjf closed this as completed Dec 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs reproduction 🔍 Need a way to reproduce it locally on a maintainer's machine
Projects
None yet
Development

No branches or pull requests

2 participants