Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
修复Windows Server系统下,项目启动找不到(translate.factory)模块的问题。
版本:1.6.0
前置原因:在win10系统下可以正常启动,迁移到Windows Server系统后,启动报错:ModuleNotFoundError: No module named 'translate.factory'。
详细堆栈信息:
Traceback (most recent call last):
File "app.py", line 8, in
from channel import channel_factory
File "D:\chatgpt-on-wechat\channel\channel_factory.py", line 5, in
from .channel import Channel
File "D:\chatgpt-on-wechat\channel\channel.py", line 5, in
from bridge.bridge import Bridge
File "D:\chatgpt-on-wechat\bridge\bridge.py", line 11, in
from translate.factory import create_translator
ModuleNotFoundError: No module named 'translate.factory'
已确认依赖均已下载的情况下,根据错误提示,排查代码找到原因:bridge文件导入的translate.factory模块在文件的上一级目录下,所以在同级目录下找不到此类文件。
解决方案已应用:在目标文件内添加上一级搜索路径。