dr413677671 / PromptGallery-stable-diffusion-webui

A prompt cookbook worked as stable-diffusion-webui extenstions.
Apache License 2.0
153 stars 16 forks source link

Extension breaks when --data-dir is used. #34

Closed OgalFinklestein closed 1 year ago

OgalFinklestein commented 1 year ago

I recently added --data-dir to my A1111 SD webui-user file. That flag changes the location of where the "extensions" folder is located.

This breaks your extension (that previously worked) with a "No such file or directory" error looking for "extensions/prompt_gallery_name.json". The file that throws the exception is extensions\PromptGallery-stable-diffusion-webui\scripts\prompt_gallery.py, line 34, in on_ui_settings: open("./extensions/prompt_gallery_name.json") as fd

OgalFinklestein commented 1 year ago

I think this is part of a larger issue with --data-dir.

OgalFinklestein commented 1 year ago

Although the suggestion in the other bug fixes other SD extensions (that is, add --gradio-allowed-path), this extension is still throwing that same exception above. Nothing responding on :5173.

Riam-Mar commented 1 year ago

On the other post of mine

The --gradio-allowed-path doesn't actually fix any problem with an extension but with gradio not being allowed to access the files.

CMD line args for extensions in this extension

The problem here seems to be, that it's not really looking up the --data-dir but just goes for an "extensions" folder. You should actually have a folder A1111-DIR/extensions/Prompt Gallery/ with a subfolder assets, if you used the extension.

I made some changes so the scripts use the extension_dir with from modules.paths_internal import extensions_dir.

You will have to replace the code in your user-dir extension and in the scripts file in the A1111 directory

PasteBins

I tested it with A1111 1.5.1 and LobeHub and it worked.

Suggestion to the devs

Import A1111's extensions_dir from modules.paths_internal and use it to get the extension name to create the OUTPATH_SAMPLES and OUTPATH_GRIDS in the scripts file of the A1111 scripts directory.

Same for checking the extension name and the StaticFiles mount in the extensions script file.

dr413677671 commented 1 year ago

Thanks for the issue and solution . Added a fix . @OgalFinklestein @Riam-Mar could you please try.

Riam-Mar commented 1 year ago

Removed extension from user-dir and a1111-dir, re-installed: Works as expected for me.

OgalFinklestein commented 1 year ago

Confirmed. Working once again.

webcoderz commented 11 months ago

Seems to still be an issue , happening to me recently