wechaty / python-wechaty

Python Wechaty is a Conversational RPA SDK for Chatbot Makers written in Python
https://wechaty.readthedocs.io/zh_CN/latest/
Apache License 2.0
1.55k stars 229 forks source link

[ValueERR] mutable default <class 'wechaty_puppet.schemas.puppet.PuppetOptions'> for field puppet_options is not allowed: use default_factory #422

Open minkuang1982 opened 4 months ago

minkuang1982 commented 4 months ago

"""doc""" import asyncio import logging from typing import Optional, Union from wechaty_puppet import FileBox

from urllib.parse import urlparse def get_host(url: str) -> (str, str, str): parsed_url = urlparse(url) return parsed_url.scheme, parsed_url.netloc, parsed_url.path

import urllib3 urllib3.get_host = get_host

from wechaty import Wechaty, Contact

Then Error happened: Exception has occurred: ValueError mutable default <class 'wechaty_puppet.schemas.puppet.PuppetOptions'> for field puppet_options is not allowed: use default_factory File "D:\AI\DingDongBotPy\DingDongBot.py", line 15, in from wechaty import Wechaty, Contact ValueError: mutable default <class 'wechaty_puppet.schemas.puppet.PuppetOptions'> for field puppet_options is not allowed: use default_factory

how to solve it ?

doublewinter0 commented 3 months ago

You may try Python 3.10