Jacob Singer
Jacob Singer

Reputation: 23

PyLint not recognizing mainloop() member of the turtle module

I am trying out the turtle module of python, and though the program is executing correctly, PyLint has been incorrectly marking parts of the program as errors. The program polygon.py consists of the following:

import turtle 
t = turtle.Turtle() 
t.fd(100) 
turtle.mainloop() 

This program executes as expected, with the turtle moving forward 100 pixels. However, in VSCode, PyLint underlines turtle.mainloop() as an error, saying:

Module 'turtle' has no 'mainloop' member pylint(no-member)

Additionally, in the actual turtle.py module, mentions of mainloop() along with some other members are also marked as errors, saying:

"mainloop" is not defined Pylance (reportUndefinedVariable) 

I tried uninstalling and reinstalling PyLint, although the errors continued to display. How can I fix them, or at least hide them considering the program otherwise works fine?

Upvotes: 0

Views: 142

Answers (1)

Dharman
Dharman

Reputation: 33237

After some searching, I found a solution for the false-positive no member error. For PyLint, go to the corresponding JSON file and add:

"python.linting.pylintArgs":[
        "--generated-members"
]

Added on behalf of the question author.

Upvotes: 1

Related Questions