0

Recently set up c++, noticed that the #include <library> were underlined. error read: library.h file can not be accessed

despite this the code still ran, recently start a new python project and same thing, vscode doesnt recognise my imported modules but despite this the code runs fine.

Anyone know the source of this?

note: when setting up c++ I initially installed minGW but ran into some errors so I switched to MSYS2 (uninstalled and removed path variables for minGW) which works but has the aforementioned error.

New approach: changed import, and modified pylint error. Also something that I didnt mention some code does not have an error associated with it even though it doesn't seem to be any different to lines that do.

Note: I can no longer access RLEACCEL var with the new import method (not a big deal as it is not necessary)

Note: had to delete c++ links as I'm limited with how many links my post can have

new python import

disabled pylint error (I think)

error for pygame.init()

example of code that has no associated errors

modification of code to use new locals import

errors still showing up

python imported libraries

logged errors for python

Tristan
  • 3
  • 2
  • When you use python, what modules are imported? If possible, please provide us with screenshots of related errors so that we can further analyze the errors. (Please overwrite personal information such as the user name in the screenshot.) – Jill Cheng Dec 07 '20 at 03:31
  • @JillCheng thanks for the reply, I updated my question with the error logs – Tristan Dec 08 '20 at 04:26

1 Answers1

0
  1. About Python:

    The reason why the terminal displays "No name'K_UP' in module'pygame.locals" is that "K_UP, K_DOWN, K_w, K_s, " these are constants of "locals.py" of module "pygame".

    enter image description here

    Usually, Pylint recognizes imported statements in VSCode as importing files or methods or classes in files.

    1).When we import the pygame.locals module, these constants have already been imported into the program, so we can use from pygame import locals.

    enter image description here

    2).Since the code can be executed, we can also turn off such notifications of "pylint": (no-name-in-module)

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

enter image description here

2.About C++:

Please check if the following settings are used in "settings.json":

"C_Cpp.default.includePath": ["..."],
    "C_Cpp.default.systemIncludePath": ["..."],

enter image description here

Reference: #include errors detected. Please update your includePath.

Jill Cheng
  • 9,179
  • 1
  • 20
  • 25
  • Hey @JillCheng, thanks for the indepth answer. Unfortunately I am still running into some problems (maybe I have incorrectly implemented your sol), I have updated my post with some examples – Tristan Dec 08 '20 at 23:22
  • @Tristan -I noticed that the display is "no-member" this time. If the code can be executed, you could use a similar method to turn off such information from "Pylint". ("no-member": E1101 reference: [no member](https://github.com/janjur/readable-pylint-messages/blob/master/README.md#no-member)) – Jill Cheng Dec 09 '20 at 01:38
  • Thanks Jill, now that I better understand the problem I found this prior question: https://stackoverflow.com/questions/56844378/pylint-no-member-issue-but-code-still-works-vscode which had the solution ("python.linting.pylintArgs": ["--generate-members"]) – Tristan Dec 10 '20 at 05:01
  • @Tristan -Yes, this can turn off Pylint notifications, but it will turn off all Pylint messages. It is better to turn off certain types of notifications to avoid ignoring other useful information. Or, it is recommended that you use it to turn off all Pylint notifications after the code can be executed. – Jill Cheng Dec 10 '20 at 05:20
  • thanks, I adjusted for this and I think I correctly implemented the specific pylint disables now. – Tristan Dec 11 '20 at 02:52