Tencent / LightDiffusionFlow

This extension is developed for AUTOMATIC1111's Stable Diffusion web UI that provides import/export options for parameters.
https://www.lightflow.ai/
Other
811 stars 45 forks source link

ModuleNotFoundError: No module named 'scripts.lightdiffusionflow_config' #24

Closed jason571 closed 8 months ago

jason571 commented 10 months ago

当scripts目录下有多个py模块文件时,python文件会提示下面错误,怎么解决这个问题,试了各种方法不行。 包括增加sys.path.appent(''), 使用init.py可以临时解决,但是如果其他插件也是在scripts目录有多个问题,第一个使用的有效,其他的就不能使用 *** Error loading script: state_api.py Traceback (most recent call last): File "/mnt/p/home/flyang/stable-diffusion-webui/modules/scripts.py", line 381, in load_scripts script_module = script_loading.load_module(scriptfile.path) File "/mnt/p/home/flyang/stable-diffusion-webui/modules/script_loading.py", line 12, in load_module module_spec.loader.exec_module(module) File "", line 883, in exec_module File "", line 241, in _call_with_frames_removed File "/mnt/p/home/flyang/stable-diffusion-webui/extensions/LightDiffusionFlow/scripts/state_api.py", line 26, in from scripts import lightdiffusionflow_version, lightdiffusionflow_config ImportError: cannot import name 'lightdiffusionflow_version' from 'scripts' (/home/flyang/.local/lib/python3.10/site-packages/scripts/init.py)


*** Error loading script: state_settings.py Traceback (most recent call last): File "/mnt/p/home/flyang/stable-diffusion-webui/modules/scripts.py", line 381, in load_scripts script_module = script_loading.load_module(scriptfile.path) File "/mnt/p/home/flyang/stable-diffusion-webui/modules/script_loading.py", line 12, in load_module module_spec.loader.exec_module(module) File "", line 883, in exec_module File "", line 241, in _call_with_frames_removed File "/mnt/p/home/flyang/stable-diffusion-webui/extensions/LightDiffusionFlow/scripts/state_settings.py", line 4, in from scripts.lightdiffusionflow_config import OutputPrompt ModuleNotFoundError: No module named 'scripts.lightdiffusionflow_config'

LegionFu commented 10 months ago

我其实有点没太懂你是什么情况。你是修改了插件代码然后出现了这个问题?还是直接安装完运行就有这个问题? 正常这个scripts目录在启动加载的时候sd会自动加到环境里,所以代码里直接这样加载应该是没问题的。 或者有可能是你其他装了什么插件之类的出现了冲突?你可以再仔细说一下你具体的情况,方便我们定位问题。

LegionFu commented 10 months ago

更新一下代码再试试?今天发现有部分人加载会出现这个错误,所以我修改了一下代码的写法,现在应该没问题了。