Forums

TypeError: issubclass() arg 1 must be a class

Installed the vkbottle module through the console, I import it into the code and an error appears:

from vkbottle import Bot, Message, keyboard_gen, types

Traceback (most recent call last):
  File "/home/zxqb/zanovo.py", line 1, in <module>
    from vkbottle import Bot, Message, keyboard_gen, types
  File "/home/zxqb/.local/lib/python3.8/site-packages/vkbottle/__init__.py", line 1, in <module>
    from .framework import Bot, Branch, ExitBranch, User, rule, branch
  File "/home/zxqb/.local/lib/python3.8/site-packages/vkbottle/framework/__init__.py", line 1, in <module>
    from .bot import Bot
  File "/home/zxqb/.local/lib/python3.8/site-packages/vkbottle/framework/bot.py", line 10, in <module>
    from .branch import BranchManager
  File "/home/zxqb/.local/lib/python3.8/site-packages/vkbottle/framework/branch/__init__.py", line 1, in <module>
    from .branch import BranchManager
  File "/home/zxqb/.local/lib/python3.8/site-packages/vkbottle/framework/branch/branch.py", line 4, in <module>
    from .cls import FunctionBranch, AbstractBranch
  File "/home/zxqb/.local/lib/python3.8/site-packages/vkbottle/framework/branch/cls.py", line 4, in <module>
    from ...types import Message
  File "/home/zxqb/.local/lib/python3.8/site-packages/vkbottle/types/__init__.py", line 1, in <module>
    from . import additional, attachments
  File "/home/zxqb/.local/lib/python3.8/site-packages/vkbottle/types/additional/__init__.py", line 6, in <module>
    from .place import Place, GeoPlace
  File "/home/zxqb/.local/lib/python3.8/site-packages/vkbottle/types/additional/place.py", line 6, in <module>
    class Place(BaseModel):
Traceback (most recent call last):
  File "/home/zxqb/zanovo.py", line 1, in <module>
    from vkbottle import Bot, Message, keyboard_gen, types
  File "/home/zxqb/.local/lib/python3.8/site-packages/vkbottle/__init__.py", line 1, in <module>
    from .framework import Bot, Branch, ExitBranch, User, rule, branch
  File "/home/zxqb/.local/lib/python3.8/site-packages/vkbottle/framework/__init__.py", line 1, in <module>
    from .bot import Bot
  File "/home/zxqb/.local/lib/python3.8/site-packages/vkbottle/framework/bot.py", line 10, in <module>
    from .branch import BranchManager
  File "/home/zxqb/.local/lib/python3.8/site-packages/vkbottle/framework/branch/__init__.py", line 1, in <module>
    from .branch import BranchManager
  File "/home/zxqb/.local/lib/python3.8/site-packages/vkbottle/framework/branch/branch.py", line 4, in <module>
    from .cls import FunctionBranch, AbstractBranch
  File "/home/zxqb/.local/lib/python3.8/site-packages/vkbottle/framework/branch/cls.py", line 4, in <module>
    from ...types import Message
  File "/home/zxqb/.local/lib/python3.8/site-packages/vkbottle/types/__init__.py", line 1, in <module>
    from . import additional, attachments
  File "/home/zxqb/.local/lib/python3.8/site-packages/vkbottle/types/additional/__init__.py", line 6, in <module>
    from .place import Place, GeoPlace
  File "/home/zxqb/.local/lib/python3.8/site-packages/vkbottle/types/additional/place.py", line 6, in <module>
    class Place(BaseModel):
  File "pydantic/main.py", line 199, in pydantic.main.ModelMetaclass.__new__
  File "pydantic/fields.py", line 277, in pydantic.fields.ModelField.infer
  File "pydantic/fields.py", line 249, in pydantic.fields.ModelField.__init__
  File "pydantic/fields.py", line 329, in pydantic.fields.ModelField.prepare
  File "pydantic/fields.py", line 391, in pydantic.fields.ModelField._type_analysis
  File "/usr/lib/python3.8/typing.py", line 771, in __subclasscheck__
    return issubclass(cls, self.__origin__)
TypeError: issubclass() arg 1 must be a class
>>>

what's wrong?

I was not able to reproduce it. It installs and imports just fine for me. Is it a specific version of the module?

no I install this module using the command in the console: pip3.7 install —user vkbottle also tried another version of python - 3.8 - did not help tried to install vkbottle 2.5 - did not helpп

Try with the virtual environment. https://help.pythonanywhere.com/pages/VirtualenvsExplained

If I use virtual environment, then an error comes out:

File "bot1.py", line 6, in <module> bot = Bot("key") File "/home/zxqb/.virtualenvs/myproject/lib/python3.7/site-packages/vkbottle/framework/bot.py", line 104, in init self.group_id = group_id or self.get_id_by_token(token) File "/home/zxqb/.virtualenvs/myproject/lib/python3.7/site-packages/vkbottle/framework/bot.py", line 178, in get_id_by_token if "error" in response: TypeError: argument of type 'NoneType' is not iterable

That looks like you're not getting a response of some sort, which suggests to me that vkbottle is not using the proxy. Check the vkbottle documentation for how to configure it to use a proxy and see http://help.pythonanywhere.com/pages/403ForbiddenError/ for the details that you need to configure.