0

Pylint is throwing an error on a member that works when I run the code. How to remove this error? The following code shows on which line the error is coming.

Class User(db.Model):
    # ...

    following = db.relationship(
            ... #Some parameters
            )

    def follow(self, user):
        if not self.is_following(user):
            self.following.append(user).   # ---- ERROR


    def is_following(self, user):
        if user.id is None:
            return False
        return self.following.filter_by(
            followed_by_id=user.id).first() is not None

On trying to append users. I am thrown an error by pylint in VS Code saying.

Instance of 'relationship' has no 'append' member pylint(no-member)

  1. How can I eliminate this error.
  2. Is there any special Intellisense for sqlAlchemy?

Note: adding db.relationship.* in pyLintArgs after --generated-members is also not removing the error

Shivansh Jagga
  • 1,541
  • 1
  • 15
  • 24
  • Note: adding db.relationship.* in pyLintArgs --generated-members also not working – Shivansh Jagga Aug 02 '20 at 12:58
  • Does this answer your question? [Instance of 'SQLAlchemy' has no 'Column' member (no-member)](https://stackoverflow.com/questions/53975234/instance-of-sqlalchemy-has-no-column-member-no-member) – Ruben Helsloot Aug 18 '20 at 17:56
  • It tries to answer it. But doesn't solve it. I solved it with a workaround though. I had to import Relationship from SQLAlchemy and then use `Relationship` in the code instead of directly using `db.relationship` – Shivansh Jagga Aug 18 '20 at 18:26
  • I was talking about the second answer; installing `pylint-flask` – Ruben Helsloot Aug 18 '20 at 18:28
  • Yes, I had tried that earlier as well but it still does not solve that problem. – Shivansh Jagga Aug 18 '20 at 19:13

0 Answers0