Closed Moemu closed 1 month ago
可以提供下配置截图,这个变量正常来说应该是存在的,webui这个配置存在 ,说明变量也存在,这个重定义在正常运行逻辑下应该不会发生
可问题就是无论更改任何设置(或者就算不改),报错都是一样的:(
可问题就是无论更改任何设置(或者就算不改),报错都是一样的:(
说明你改错了,直接注释了
呃,我试着研究了webui.py
的代码,发现只要我把页面配置中的本地问答关了这个错误就会出现,再打开就又好了
呃,我试着研究了
webui.py
的代码,发现只要我把页面配置中的本地问答关了这个错误就会出现,再打开就又好了
实在不行的话 只能改一下这个逻辑了,这个变量定义的位置确实晚于调用,但webui的加载后 手动操作才会调用,可以确认下webui程序是否被误动了
操作系统
Windows
Python 版本
3.10.11
AI Vtuber 版本
20240728
描述问题
在webui更改设置后出现NameError: free variable 'textarea_local_qa_text_json_file_content' referenced before assignment in enclosing scope错误。重启程序后发现更改的配置项未保存
复现步骤
· 运行 1.双击我启动程序.bat,打开Webui · 更改配置项弹幕日志类型为“问答” · 保存配置。出现错误
注:于昨日运行2-1.强制更新至主线版本(得先安装git).bat
期望的结果
成功保存配置文件
截图或日志
2024-07-29 17:18:32.755 | DEBUG | utils.my_log::57 - 配置文件路径=config.json
2024-07-29 17:18:32.927 | INFO | utils.audio:init:78 - 文案模式的Audio初始化...
2024-07-29 17:18:32.950 | INFO | main:goto_func_page:5444 - 本地Live2D模型名列表:['chitose', 'Haru', 'haruto', 'hibiki', 'Hiyori', 'koharu', 'miara_pro_en', 'nito', 'sizuku', 'tsumiki', 'tuzi main', '少女a dlc']
2024-07-29 17:18:33.000 | INFO | main:goto_func_page:5642 - 声卡输入设备=[{'device_index': 0, 'device_info': 'Microsoft 声音映射器 - Input'}, {'device_index': 1, 'device_info': '麦克风阵列 (Realtek(R) Audio)'}, {'device_index': 2, 'device_info': '麦克风 (Realtek(R) Audio)'}, {'device_index': 3, 'device_info': 'CABLE Output (VB-Audio Virtual '}, {'device_index': 8, 'device_info': '主声音捕获驱动程序'}, {'device_index': 9, 'device_info': '麦克风阵列 (Realtek(R) Audio)'}, {'device_index': 10, 'device_info': '麦克风 (Realtek(R) Audio)'}, {'device_index': 11, 'device_info': 'CABLE Output (VB-Audio Virtual Cable)'}, {'device_index': 19, 'device_info': '麦克风阵列 (Realtek(R) Audio)'}, {'device_index': 20, 'device_info': '麦克风 (Realtek(R) Audio)'}, {'device_index': 21, 'device_info': 'CABLE Output (VB-Audio Virtual Cable)'}, {'device_index': 24, 'device_info': '电脑扬声器 (Realtek HD Audio output with HAP)'}, {'device_index': 25, 'device_info': '麦克风 (Realtek HD Audio Mic input)'}, {'device_index': 27, 'device_info': '麦克风阵列 (Realtek HD Audio Mic Array input)'}, {'device_index': 28, 'device_info': '立体声混音 (Realtek HD Audio Stereo input)'}, {'device_index': 29, 'device_info': 'CABLE Output (VB-Audio Point)'}]
Building prefix dict from the default dictionary ...
Loading model from cache C:\Users\Moemu\AppData\Local\Temp\jieba.cache
Loading model cost 0.301 seconds.
Prefix dict has been built successfully.
NiceGUI ready to go on http://localhost:8081
free variable 'textarea_local_qa_text_json_file_content' referenced before assignment in enclosing scope
Traceback (most recent call last):
File "C:\Muice-Vtuber\AI-Vtuber-20240229\Miniconda3\lib\site-packages\nicegui\events.py", line 401, in handle_event
result = handler(arguments) if expects_arguments else handler()
File "C:\Muice-Vtuber\AI-Vtuber-20240229\webui.py", line 6518, in
button_save = ui.button('保存配置', on_click=lambda: save_config(), color=button_bottom_color).style(button_bottom_css).tooltip("保存webui的配置到本地文件,有些配置保存后需要重启生效")
File "C:\Muice-Vtuber\AI-Vtuber-20240229\webui.py", line 2819, in save_config
if not check_config():
File "C:\Muice-Vtuber\AI-Vtuber-20240229\webui.py", line 1400, in check_config
if common.is_json_convertible(textarea_local_qa_text_json_file_content.value) == False:
NameError: free variable 'textarea_local_qa_text_json_file_content' referenced before assignment in enclosing scope