Andy Allan
Andy Allan

Reputation: 1

pylance report GeneralTypeIssues on members while typing pycurl example

I am a python beginner learning pycurl with its example on VSCode.

import pycurl
from io import BytesIO

buffer = BytesIO()
c = pycurl.Curl()
c.setopt(c.INTERFACE, 'lo')
c.setopt(c.URL, "http://127.0.0.1")
c.setopt(c.WRITEDATA, buffer)
c.perform()
c.close()

body = buffer.getvalue()
print(body.decode('UTF-8'))

But pylance reports GeneralTypeIssues on Curl members as picture below: GeneralTypeIssues

Cannot access member "INTERFACE" for type "Curl" Member "INTERFACE" is unknownPylancereportGeneralTypeIssues

I don't know where I can report this issue on Pylance or pycurl so I came to stackoverflow for help.

Upvotes: 0

Views: 281

Answers (1)

MingJie-MSFT
MingJie-MSFT

Reputation: 9447

I think that's the problem:

c.setopt(c.INTERFACE, 'lo')
c.setopt(c.URL, "http://127.0.0.1")
c.setopt(c.WRITEDATA, buffer)

Think again about whether you can use c.INTERFACE. c is a curl while INTERFACE is a property of pycurl. You can try to change c.INTERFACE into pycurl.INTERFACE

Upvotes: 1

Related Questions