Hi, tell me, one of me has such a warning from Paycharm when importing:
from http import HTTPMethod
notice from paycharm: "Cannot find reference ‘HTTPMethod’ in ‘init.pyi’ "
Hi, tell me, one of me has such a warning from Paycharm when importing:
from http import HTTPMethod
notice from paycharm: "Cannot find reference ‘HTTPMethod’ in ‘init.pyi’ "
I don’t think the http
package has that class:
>>> import http
>>> dir(http)
['HTTPStatus', 'IntEnum', '__all__', '__builtins__', '__cached__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__path__', '__spec__']
>>>
My bad: I see it the docs, but you’ll need Python version 3.11
I also thought that the problem was in the version, but I have the latest release installed.
My version: Python 3.11.3
The only thing I can suggest, is that PyCharm is not using 3.11, but as I’m not a PyCharm user, I can’t advise you on how to check/change that; sorry.
Too add: maybe this will help
No, it’s all right here
Not sure if you’ve tried this, but if you run this script…
from html import parser
help(parser)
print(dir(parser))
… from within PyCharm, do you see any reference to HTTPMethod
?
Of course, I’m assuming that HTTPMethod
is coming from parser
, but I could be wrong about that, but if it does, you could use the code line from html.parser import HTTPMethod
If you have an older version of mypy
installed, mypy/typeshed/stdib/http/__init__.pyi
is probably out of date.