gwax / pylint-sqlalchemy

pylint plugin to fix incompatibility issues with sqlalchemy
MIT License
4 stars 5 forks source link

Fatal error when running with python 3.9 #5

Open chilicheech opened 2 years ago

chilicheech commented 2 years ago
Exception on node <ImportFrom l.27 at 0x1027d7910> in file '/Users/user1/dev/dev1/dev1.py'
Traceback (most recent call last):
  File "/Users/user1/.pyenv/versions/3.9.7/envs/env1/lib/python3.9/site-packages/pylint/utils/ast_walker.py", line 72, in walk
    callback(astroid)
  File "/Users/user1/.pyenv/versions/3.9.7/envs/env1/lib/python3.9/site-packages/pylint/checkers/variables.py", line 1345, in visit_importfrom
    self._check_module_attrs(node, module, name.split("."))
  File "/Users/user1/.pyenv/versions/3.9.7/envs/env1/lib/python3.9/site-packages/pylint/checkers/variables.py", line 2168, in _check_module_attrs
    module = next(module.getattr(name)[0].infer())
  File "/Users/user1/.pyenv/versions/3.9.7/envs/env1/lib/python3.9/site-packages/astroid/nodes/node_ng.py", line 150, in infer
    yield from self._infer(context, **kwargs)
  File "/Users/user1/.pyenv/versions/3.9.7/envs/env1/lib/python3.9/site-packages/astroid/decorators.py", line 142, in raise_if_nothing_inferred
    yield next(generator)
  File "/Users/user1/.pyenv/versions/3.9.7/envs/env1/lib/python3.9/site-packages/astroid/decorators.py", line 111, in wrapped
    for res in _func(node, context, **kwargs):
  File "/Users/user1/.pyenv/versions/3.9.7/envs/env1/lib/python3.9/site-packages/astroid/bases.py", line 157, in _infer_stmts
    for inf in stmt.infer(context=context):
  File "/Users/user1/.pyenv/versions/3.9.7/envs/env1/lib/python3.9/site-packages/astroid/nodes/node_ng.py", line 164, in infer
    for i, result in enumerate(generator):
  File "/Users/user1/.pyenv/versions/3.9.7/envs/env1/lib/python3.9/site-packages/astroid/decorators.py", line 142, in raise_if_nothing_inferred
    yield next(generator)
  File "/Users/user1/.pyenv/versions/3.9.7/envs/env1/lib/python3.9/site-packages/astroid/decorators.py", line 111, in wrapped
    for res in _func(node, context, **kwargs):
  File "/Users/user1/.pyenv/versions/3.9.7/envs/env1/lib/python3.9/site-packages/astroid/inference.py", line 241, in infer_call
    for callee in self.func.infer(context):
  File "/Users/user1/.pyenv/versions/3.9.7/envs/env1/lib/python3.9/site-packages/astroid/nodes/node_ng.py", line 164, in infer
    for i, result in enumerate(generator):
  File "/Users/user1/.pyenv/versions/3.9.7/envs/env1/lib/python3.9/site-packages/astroid/decorators.py", line 142, in raise_if_nothing_inferred
    yield next(generator)
  File "/Users/user1/.pyenv/versions/3.9.7/envs/env1/lib/python3.9/site-packages/astroid/decorators.py", line 111, in wrapped
    for res in _func(node, context, **kwargs):
  File "/Users/user1/.pyenv/versions/3.9.7/envs/env1/lib/python3.9/site-packages/astroid/bases.py", line 157, in _infer_stmts
    for inf in stmt.infer(context=context):
  File "/Users/user1/.pyenv/versions/3.9.7/envs/env1/lib/python3.9/site-packages/astroid/nodes/node_ng.py", line 164, in infer
    for i, result in enumerate(generator):
  File "/Users/user1/.pyenv/versions/3.9.7/envs/env1/lib/python3.9/site-packages/astroid/decorators.py", line 142, in raise_if_nothing_inferred
    yield next(generator)
  File "/Users/user1/.pyenv/versions/3.9.7/envs/env1/lib/python3.9/site-packages/astroid/decorators.py", line 111, in wrapped
    for res in _func(node, context, **kwargs):
  File "/Users/user1/.pyenv/versions/3.9.7/envs/env1/lib/python3.9/site-packages/astroid/bases.py", line 157, in _infer_stmts
    for inf in stmt.infer(context=context):
  File "/Users/user1/.pyenv/versions/3.9.7/envs/env1/lib/python3.9/site-packages/astroid/nodes/node_ng.py", line 164, in infer
    for i, result in enumerate(generator):
  File "/Users/user1/.pyenv/versions/3.9.7/envs/env1/lib/python3.9/site-packages/astroid/decorators.py", line 142, in raise_if_nothing_inferred
    yield next(generator)
  File "/Users/user1/.pyenv/versions/3.9.7/envs/env1/lib/python3.9/site-packages/astroid/decorators.py", line 111, in wrapped
    for res in _func(node, context, **kwargs):
  File "/Users/user1/.pyenv/versions/3.9.7/envs/env1/lib/python3.9/site-packages/astroid/inference.py", line 293, in infer_import_from
    module = self.do_import_module()
  File "/Users/user1/.pyenv/versions/3.9.7/envs/env1/lib/python3.9/site-packages/astroid/mixins.py", line 108, in do_import_module
    return mymodule.import_module(
  File "/Users/user1/.pyenv/versions/3.9.7/envs/env1/lib/python3.9/site-packages/astroid/nodes/scoped_nodes/scoped_nodes.py", line 739, in import_module
    return AstroidManager().ast_from_module_name(absmodname)
  File "/Users/user1/.pyenv/versions/3.9.7/envs/env1/lib/python3.9/site-packages/astroid/manager.py", line 211, in ast_from_module_name
    return self.ast_from_file(found_spec.location, modname, fallback=False)
  File "/Users/user1/.pyenv/versions/3.9.7/envs/env1/lib/python3.9/site-packages/astroid/manager.py", line 124, in ast_from_file
    return AstroidBuilder(self).file_build(filepath, modname)
  File "/Users/user1/.pyenv/versions/3.9.7/envs/env1/lib/python3.9/site-packages/astroid/builder.py", line 151, in file_build
    return self._post_build(module, encoding)
  File "/Users/user1/.pyenv/versions/3.9.7/envs/env1/lib/python3.9/site-packages/astroid/builder.py", line 175, in _post_build
    module = self._manager.visit_transforms(module)
  File "/Users/user1/.pyenv/versions/3.9.7/envs/env1/lib/python3.9/site-packages/astroid/manager.py", line 101, in visit_transforms
    return self._transform.visit(node)
  File "/Users/user1/.pyenv/versions/3.9.7/envs/env1/lib/python3.9/site-packages/astroid/transforms.py", line 96, in visit
    return self._visit(module)
  File "/Users/user1/.pyenv/versions/3.9.7/envs/env1/lib/python3.9/site-packages/astroid/transforms.py", line 61, in _visit
    visited = self._visit_generic(value)
  File "/Users/user1/.pyenv/versions/3.9.7/envs/env1/lib/python3.9/site-packages/astroid/transforms.py", line 68, in _visit_generic
    return [self._visit_generic(child) for child in node]
  File "/Users/user1/.pyenv/versions/3.9.7/envs/env1/lib/python3.9/site-packages/astroid/transforms.py", line 68, in <listcomp>
    return [self._visit_generic(child) for child in node]
  File "/Users/user1/.pyenv/versions/3.9.7/envs/env1/lib/python3.9/site-packages/astroid/transforms.py", line 74, in _visit_generic
    return self._visit(node)
  File "/Users/user1/.pyenv/versions/3.9.7/envs/env1/lib/python3.9/site-packages/astroid/transforms.py", line 64, in _visit
    return self._transform(node)
  File "/Users/user1/.pyenv/versions/3.9.7/envs/env1/lib/python3.9/site-packages/astroid/transforms.py", line 46, in _transform
    ret = transform_func(node)
  File "/Users/user1/.pyenv/versions/3.9.7/envs/env1/lib/python3.9/site-packages/pylint_sqlalchemy/plugin.py", line 19, in handle_session
    cls.locals[method] = session.locals[method]
AttributeError: 'ImportFrom' object has no attribute 'locals'
dev1/dev1.py:1:0: F0001: Fatal error while checking 'dev1/dev1.py'. Please open an issue in our bug tracker so we address this. There is a pre-filled template that you can use in '/Users/user1/Library/Caches/pylint/pylint-crash-2022-01-13-09.txt'. (fatal)

Cheers

nyddogghr commented 2 years ago

I have the same issue on python 3.9.2.

nyddogghr commented 2 years ago

Anything new? Or planned?

nyddogghr commented 1 year ago

Up?

adifelice-godaddy commented 1 year ago

I submitted a PR with a fix: https://github.com/gwax/pylint-sqlalchemy/pull/6