python-wechaty icon indicating copy to clipboard operation
python-wechaty copied to clipboard

๐Ÿ›๐Ÿ› Bug Report: plugin cannot obtain self.name

Open bigbrother666sh opened this issue 3 years ago โ€ข 1 comments

requirements

  • token type๏ผšpadlocal docker 0.65
  • version of python-wechaty :0.8.62

Plugins cannot get self.name

File "/home/bigbrother666/CommunityAssistant/run.py", line 22, in <module>
    TrainingPlugin(),
  File "/home/bigbrother666/CommunityAssistant/antigen_bot/plugins/training.py", line 28, in __init__
    self.cache_dir = f'./.{self.name}'
AttributeError: can't set attribute

Reproduce your problem

    def __init__(self, options: Optional[WechatyPluginOptions] = None):
        super().__init__(options)

        # 2. save the log info into <plugin_name>.log file
        self.cache_dir = f'./.{self.name}'
        self.file_cache_dir = f'{self.cache_dir}/file'
        os.makedirs(self.file_cache_dir, exist_ok=True)

        log_file = os.path.join(self.cache_dir, 'log.log')
        self.logger = get_logger(self.name, log_file)

bigbrother666sh avatar Jul 19 '22 07:07 bigbrother666sh

This issue has been fixed by the latest package, you can upgrade it to fix it.

wj-Mcat avatar Jul 31 '22 07:07 wj-Mcat