简体   繁体   中英

Error: Module 'pygame' has no 'init' member

I'm using VS Code and when I use pygame.init() this error appears:

Module 'pygame' has no 'init' member

I tried to add --extension-pkg-whitelist=pygame to python.linting.pylintArgs in the settings and the error stopped, but then almost all of my code turns blue and says those errors:

Constant name "grid1" doesn't conform to UPPER_CASE naming stylepylint(invalid-name)

Edit : So this is a linter warning, I would like to remove but when I tried using the method above, everything gets a blue line under it.

My OS is Windows 10 and I'm using the latest python version and latest pygame version.

You are getting bombarded by those errors as your probably code does not conform to the PEP8 style of writing Python code.

Right-click anywhere in your file and click Format Document or press Alt+Shift+F to format your code automatically. After that, just look at the remaining warnings and errors and try to fix them. The errors are probably just asking you to make docstring for functions and classes.

If you don't want to write docstrings, add this to your VSCode settings.json file

"python.linting.pylintArgs": [
    "--disable=C0114, C0116",
],

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM