Closed FilkerZero closed 4 months ago
I can confirm with forge as well, after update the extension no longer loads at all.
Same here on forge.
same bug here too on a1111-webui
Hi all, I'm not a big participant on github or particularly familiar with Python, but I think I can see where the problem is coming from. My apologies in advance if the following is all glaringly obvious to everyone already:
Three scripts are trying to import and/or use the debug_print
function, which they're expecting to find in scripts/civitai_global.py.
The three scripts in question are:
In each case, they're trying to import the function from the scripts/civitai_global.py file however that script doesn't expose debug_print
in the global
statement: https://github.com/BlafKing/sd-civitai-browser-plus/blob/b39a2c2128ce5ce74d7231b1ee42e89b2e220082/scripts/civitai_global.py#L6
Nor does it define it as a debug_print
function as it does for print
towards the bottom of the file:
_print = print
def print(print_message):
_print(f'\033[96mCivitAI Browser+\033[0m: {print_message}')
I'm just guessing here but I'd imagine from looking at the code that we could probably get local copies working temporarily by either editing out the references to and uses of debug_print
in those files, or defining a debug_print
function (it could even be one that doesn't do anything, though I don't know how Python deals with optional parameters and that sort of syntax) - probably just duplicating the print
definintion and function and renaming the duplicated copy so you end up with the bottom of the script looking like this:
_print = print
def print(print_message):
_print(f'\033[96mCivitAI Browser+\033[0m: {print_message}')
_debug_print = debug_print
def debug_print(print_message):
_print(f'\033[96mCivitAI Browser+ DEBUGGING MESSAGE\033[0m: {print_message}')
in civitai_global.py and adding , debug_print
(note the comma) after the word "print"at the end of the global
statement on line 6 would, I think make it work.
PLease note I haven't tried this out, so if you do want to try it locally, I'd suggest being cautious but as far as I can see there won't be any harm in doing so (other than your local version won't match the main repo and might complain if you try to git pull, but in any case once it's fixed properly at source you could simply delete your local version and install it again as normal.)
Until the developer creates the debug_print
function, you can apply this temporary fix.
In the stable-diffusion>extensions>sd-civitai-browser-plus>scripts
directory (or the equivalent location for your system), update the following 3 files:
In file: civitai_api.py
from scripts.civitai_global import print, debug_print
To:from scripts.civitai_global import print
In file:civitai_download.py
from scripts.civitai_global import print, debug_print
To:from scripts.civitai_global import print
In file: civitai_gui.py
from scripts.civitai_global import print, debug_print
To:from scripts.civitai_global import print
This temporary fix should allow you to use the extension until the developer implements the debug_print
function.
All you're doing is removing , debug_print
from the end of those lines listed above.
--Tested with Stable Diffusion WebUI Forge-- --Tested with Automatic1111 webui--
Actually a better way is to just edit civitai_global.py
instead,
At the bottom of that file add this:
def debug_print(print_message):
_print(f'\033[96mCivitAI Browser+ DEBUG\033[0m: {print_message}')
Can confirm : @philmcrakin 's solution works splendidly 👍
@philmcrakin This does work, but I've noticed that it will not show multiple versions. At least not for me.
Thanks for reporting!
The fix @philmcrakin posted was intended to be included in the update, looks like I forgot to include it 😅 Published another commit which contains this code by default.
I'll mark this as resolved 👍🏻
Describe the bug.
After reinstalling, the extension does not work
Steps to reproduce the problem.
sd-civitai-browser-plus
Apply and restart UI
buttonAutomatic1111/stable-diffusion-webui/extensions
Available
sub-tabInstalled
tab and clicked on theApply and restart UI
button*** Error loading script: civitai_download.py Traceback (most recent call last): File "D:\Automatic1111\stable-diffusion-webui\modules\scripts.py", line 527, in load_scripts script_module = script_loading.load_module(scriptfile.path) File "D:\Automatic1111\stable-diffusion-webui\modules\script_loading.py", line 10, in load_module module_spec.loader.exec_module(module) File "", line 883, in exec_module
File "", line 241, in _call_with_frames_removed
File "D:\Automatic1111\stable-diffusion-webui\extensions\sd-civitai-browser-plus\scripts\civitai_download.py", line 15, in
from scripts.civitai_global import print, debug_print
ImportError: cannot import name 'debug_print' from 'scripts.civitai_global' (D:\Automatic1111\stable-diffusion-webui\extensions\sd-civitai-browser-plus\scripts\civitai_global.py)
*** Error loading script: civitai_file_manage.py Traceback (most recent call last): File "D:\Automatic1111\stable-diffusion-webui\modules\scripts.py", line 527, in load_scripts script_module = script_loading.load_module(scriptfile.path) File "D:\Automatic1111\stable-diffusion-webui\modules\script_loading.py", line 10, in load_module module_spec.loader.exec_module(module) File "", line 883, in exec_module
File "", line 241, in _call_with_frames_removed
File "D:\Automatic1111\stable-diffusion-webui\extensions\sd-civitai-browser-plus\scripts\civitai_file_manage.py", line 20, in
import scripts.civitai_api as _api
File "D:\Automatic1111\stable-diffusion-webui\extensions\sd-civitai-browser-plus\scripts\civitai_api.py", line 19, in
from scripts.civitai_global import print, debug_print
ImportError: cannot import name 'debug_print' from 'scripts.civitai_global' (D:\Automatic1111\stable-diffusion-webui\extensions\sd-civitai-browser-plus\scripts\civitai_global.py)
*** Error loading script: civitai_gui.py Traceback (most recent call last): File "D:\Automatic1111\stable-diffusion-webui\modules\scripts.py", line 527, in load_scripts script_module = script_loading.load_module(scriptfile.path) File "D:\Automatic1111\stable-diffusion-webui\modules\script_loading.py", line 10, in load_module module_spec.loader.exec_module(module) File "", line 883, in exec_module
File "", line 241, in _call_with_frames_removed
File "D:\Automatic1111\stable-diffusion-webui\extensions\sd-civitai-browser-plus\scripts\civitai_gui.py", line 10, in
from scripts.civitai_global import print, debug_print
ImportError: cannot import name 'debug_print' from 'scripts.civitai_global' (D:\Automatic1111\stable-diffusion-webui\extensions\sd-civitai-browser-plus\scripts\civitai_global.py)
Additional information
When I did the check for updates in the extensions tab, the
sd-civitai-browser-plus
extension said something likebehind HEAD
before I hit theApply and restart UI
button.