0

Im having an issue where pylint flags the CoInitialize() line. "has no 'CoInitialize' Member pyline(no-member)"

from win32com.client import Dispatch #speaking in windows
import pythoncom
pythoncom.CoInitialize()
Windows_Speak = Dispatch("SAPI.SpVoice")

How do you do implement the solution that is mentioned everywhere --extension-pkg-whitelist=pythoncom in VSCode?

I have tried puttin this in the configurations:

{
"configurations": [
    {
        "name": "Python: Current File",
        "type": "python",
        "request": "launch",
        "program": "${file}",
        "console": "integratedTerminal"
    }               ],
    
// Whitelist NumPy to remove lint errors
"python.linting.pylintArgs": [
    "c-extension-no-member",
    "--extension-pkg-whitelist=pythoncom",
    "--unsafe-load-any-extension=y",
    "--extension-pkg-allow-list=pythoncom",
    "--ignored-classes=pythoncom",
    "--ignored-modules=pythoncom",
    "--generate-members=pythoncom.*"
]

}

Jason Rae
  • 9
  • 2

1 Answers1

0

Tried to take extension-pkg-allow-list instead of extension-pkg-whitelist.

official docs.

Steven-MSFT
  • 7,438
  • 1
  • 5
  • 13
  • Didn't work. I tried every combination of these: '"c-extension-no-member", "--extension-pkg-whitelist=pythoncom", "--unsafe-load-any-extension=y", "--extension-pkg-allow-list=pythoncom", "--ignored-classes=pythoncom", "--ignored-modules=pythoncom", "--generate-members=pythoncom.*" ] }' – Jason Rae May 20 '21 at 11:35
  • I tried locally, both '--extension-pkg-allow-list=pywin32' and '--extension-pkg-allow-list=pythoncom' works. And you have installed the pywin32, right? – Steven-MSFT May 21 '21 at 02:00
  • I have pypiwin32 installed. Which is apparently the old version? I asked conda to update and it didn't change it. I installed pywin32 with conda, and the pypiwin32 is still there and will not let me remove it. Not sure if this is the cause of the issue though. – Jason Rae May 24 '21 at 14:50
  • The version of pywin32 I am using was 227, which version are you using? you can try to uninstall and reinstall it. – Steven-MSFT May 25 '21 at 02:57
  • Conda will not remove pypiwin32. It says solving environment failed. I have installed pywin32. And so now both are on the same environment and I still cannot remove it. Thoughts? – Jason Rae May 28 '21 at 14:02
  • I am not sure what caused the problem, could you check this link? https://stackoverflow.com/questions/51266535/conda-returns-solving-environment-failed – Steven-MSFT May 31 '21 at 01:56