pythonstubs icon indicating copy to clipboard operation
pythonstubs copied to clipboard

it not working in vscode

Open mahaidong opened this issue 4 years ago • 5 comments

when I try to type import Rhino. It said

unresolved import 'Rhino'

mahaidong avatar Aug 24 '20 17:08 mahaidong

On my side, it works, but it still complains.

I have pylance enabled, and it complains on the import line that there's no module source, but autocomplete actually works. image

gonzalocasas avatar Sep 29 '20 09:09 gonzalocasas

On my side, it works, but it still complains.

I have pylance enabled, and it complains on the import line that there's no module source, but autocomplete actually works. image

hi, gonzalocasas

Do you have autocompleting for rhino module after you import rhino?

mahaidong avatar Sep 29 '20 09:09 mahaidong

Do you have autocompleting for rhino module after you import rhino?

yep

image

gonzalocasas avatar Sep 29 '20 09:09 gonzalocasas

@mahaidong we just published a new version of the stubs to pypi. Does this version work in VS Code for you now?

sbaer avatar May 24 '21 22:05 sbaer

@mahaidong Seems like the expected behavior. You can set up the stubs files from pypi as module imports, see the solution and the difference options below, depending on your needs.

Solution 1 - Autocomplete and resolve import (typically set up for real code) python.analysis.extraPaths - Add paths to stub folders as additional modules, can be relative. Remove the postfix -stubs in the stub folders. i.e. Rhino to treat them as modules.

Solution 2 - Only autocomplete (has reportMissingModuleSource warning) (I assume this is how you currently have it) python.analysis.stubPath - Default: ./typings . Open your project folder and place all stub folders in this folder.

Refer to PyLance Settings

theTonyHo avatar May 24 '21 23:05 theTonyHo