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

[Bug]: 使用cx_Freeze 和PyInstaller 打包之后报错 #421

Open kill136 opened 6 months ago

kill136 commented 6 months ago

Environment

- wechaty:0.10.7
- wechaty-puppet: 0.4.23
- wechaty-puppet-service: 0.8.10
- wechaty-plugin-contrib: 
- token type: padlocal|wxwork|xp
- the version of wechaty docker container: [0.65]

Description

Traceback (most recent call last):
  File "D:\AI\chatgpt-on-wechat\channel\chat_channel.py", line 297, in _send
    self.send(reply, context)
  File "D:\AI\chatgpt-on-wechat\channel\wechat\wechaty_channel.py", line 66, in send
    receiver = asyncio.run_coroutine_threadsafe(self.bot.Contact.find(receiver_id), loop).result()
  File "C:\Program Files\Python310\lib\concurrent\futures\_base.py", line 445, in result
    return self.__get_result()
  File "C:\Program Files\Python310\lib\concurrent\futures\_base.py", line 390, in __get_result
    raise self._exception
  File "D:\AI\chatgpt-on-wechat\venv\lib\site-packages\wechaty\user\contact.py", line 216, in find
    contacts = await cls.find_all(query)
  File "D:\AI\chatgpt-on-wechat\venv\lib\site-packages\wechaty\user\contact.py", line 265, in find_all
    contacts = cls._filter_contacts(contacts, query)
  File "D:\AI\chatgpt-on-wechat\venv\lib\site-packages\wechaty\user\contact.py", line 181, in _filter_contacts
    contacts = list(filter(func, contacts))
  File "D:\AI\chatgpt-on-wechat\venv\lib\site-packages\wechaty\user\contact.py", line 148, in filter_func
    if query == payload.id or quit == payload.weixin:
NameError: name 'quit' is not defined

Minimum reproducible code

!/user/bin/env python3

-- coding: utf-8 --

from cx_Freeze import setup, Executable import sys

print(sys.executable)

print(sys.path)

setup( name="果果客服", version="1.0", description="微信智能客服", options={ "build_exe": { "packages": ["wechaty_puppet_service", "sqlalchemy", "builtins"], "include_files": ["config.json", ("D:\AI\chatgpt-on-wechat\venv\Scripts\python.exe", "Lib\site-packages\builtins.py")] } }, executables=[Executable("app.py")], )