Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to remove custom directory #145

Open
horribleCodes opened this issue Apr 25, 2023 · 9 comments
Open

Unable to remove custom directory #145

horribleCodes opened this issue Apr 25, 2023 · 9 comments
Labels
bug Something isn't working

Comments

@horribleCodes
Copy link

Whenever I try to remove a custom directory, I get an error and my changes to the "Others" tab are lost. I select a directory from the Saved Directories-Dropdown menu, click Remove from saved directories, and the UI turns into this:

image

And the following error appears in the command log:

Traceback (most recent call last):
  File "C:\Users\stable-diffusion-webui\venv\lib\site-packages\gradio\routes.py", line 394, in run_predict
    output = await app.get_blocks().process_api(
  File "C:\Users\stable-diffusion-webui\venv\lib\site-packages\gradio\blocks.py", line 1075, in process_api
    result = await self.call_function(
  File "C:\Users\stable-diffusion-webui\venv\lib\site-packages\gradio\blocks.py", line 884, in call_function
    prediction = await anyio.to_thread.run_sync(
  File "C:\Users\stable-diffusion-webui\venv\lib\site-packages\anyio\to_thread.py", line 31, in run_sync
    return await get_asynclib().run_sync_in_worker_thread(
  File "C:\Users\stable-diffusion-webui\venv\lib\site-packages\anyio\_backends\_asyncio.py", line 937, in run_sync_in_worker_thread
    return await future
  File "C:\Users\stable-diffusion-webui\venv\lib\site-packages\anyio\_backends\_asyncio.py", line 867, in run
    result = context.run(func, *args)
  File "C:\Users\stable-diffusion-webui\modules\ui_extensions.py", line 25, in apply_and_restart
    check_access()
  File "C:\Users\stable-diffusion-webui\modules\ui_extensions.py", line 21, in check_access
    assert not shared.cmd_opts.disable_extension_access, "extension access disabled because of command line flags"
AssertionError: extension access disabled because of command line flags

Could you at least tell me where the directories are saved so I can manually remove the directory?

@AlUlkesh
Copy link
Owner

AssertionError: extension access disabled because of command line flags

That error message checks for this:

cmd_opts.disable_extension_access = (cmd_opts.share or cmd_opts.listen or cmd_opts.server_name) and not cmd_opts.enable_insecure

So, if you use share/listen/api you'll need to add --enable-insecure-extension-access to the commandline parameters.

If you want to remove the direcory manually, they are stored in the wib.sqlite3 database in the extension's main directory. Table name is path_recorder.

@horribleCodes
Copy link
Author

It doesn't work without --listen either:

Traceback (most recent call last):
  File "C:\Users\stable-diffusion-webui\venv\lib\site-packages\gradio\routes.py", line 394, in run_predict
    output = await app.get_blocks().process_api(
  File "C:\Users\stable-diffusion-webui\venv\lib\site-packages\gradio\blocks.py", line 1075, in process_api
    result = await self.call_function(
  File "C:\Users\stable-diffusion-webui\venv\lib\site-packages\gradio\blocks.py", line 884, in call_function
    prediction = await anyio.to_thread.run_sync(
  File "C:\Users\stable-diffusion-webui\venv\lib\site-packages\anyio\to_thread.py", line 31, in run_sync
    return await get_asynclib().run_sync_in_worker_thread(
  File "C:\Users\stable-diffusion-webui\venv\lib\site-packages\anyio\_backends\_asyncio.py", line 937, in run_sync_in_worker_thread
    return await future
  File "C:\Users\stable-diffusion-webui\venv\lib\site-packages\anyio\_backends\_asyncio.py", line 867, in run
    result = context.run(func, *args)
  File "C:\Users\stable-diffusion-webui\extensions\stable-diffusion-webui-images-browser\scripts\image_browser.py", line 255, in img_path_add_remove
    return path_recorder, gr.update(choices=path_recorder_formatted, value=selected)
UnboundLocalError: local variable 'path_recorder_formatted' referenced before assignment

In this case, my flags were as follows:
Launching Web UI with arguments: --xformers --opt-split-attention --deepdanbooru --no-half-vae

I am getting with same error with the --enable-insecure-extension-access flag, too.

@AlUlkesh
Copy link
Owner

That's a different error. It now gets further, but runs into a new issue.

This error should only happen, if you try to delete something that is not in the list. I'm not sure how one would do that.

Can you make screenshots of the dropdown with the directories and then the delete attempt?

@horribleCodes
Copy link
Author

I've since switched to vladmanic's fork, but I am still getting an error, albeit yet another different one.
brave_ZUuqRZjIxR
And after selecting Remove from saved directories...

Traceback (most recent call last):
  File "C:\Users\jakob\source\repos\automatic\venv\lib\site-packages\gradio\routes.py", line 394, in run_predict
    output = await app.get_blocks().process_api(
  File "C:\Users\jakob\source\repos\automatic\venv\lib\site-packages\gradio\blocks.py", line 1075, in process_api
    result = await self.call_function(
  File "C:\Users\jakob\source\repos\automatic\venv\lib\site-packages\gradio\blocks.py", line 884, in call_function
    prediction = await anyio.to_thread.run_sync(
  File "C:\Users\jakob\source\repos\automatic\venv\lib\site-packages\anyio\to_thread.py", line 31, in run_sync
    return await get_asynclib().run_sync_in_worker_thread(
  File "C:\Users\jakob\source\repos\automatic\venv\lib\site-packages\anyio\_backends\_asyncio.py", line 937, in run_sync_in_worker_thread
    return await future
  File "C:\Users\jakob\source\repos\automatic\venv\lib\site-packages\anyio\_backends\_asyncio.py", line 867, in run
    result = context.run(func, *args)
  File "C:\Users\jakob\source\repos\automatic\extensions-builtin\stable-diffusion-webui-images-browser\scripts\image_browser.py", line 959, in change_dir
    img_dir, img_path_depth = pure_path(img_dir)
  File "C:\Users\jakob\source\repos\automatic\extensions-builtin\stable-diffusion-webui-images-browser\scripts\image_browser.py", line 276, in pure_path
    match = re.search(r" \[(\d+)\]$", path)
  File "C:\Users\jakob\AppData\Local\Programs\Python\Python310\lib\re.py", line 200, in search
    return _compile(pattern, flags).search(string)
TypeError: expected string or bytes-like object

Important to note is that this time, the directory is actually properly deleted. Back in the original repo, the process and screenshot would be exactly the same, just with a different error and result.

@AlUlkesh AlUlkesh added the bug Something isn't working label Apr 30, 2023
AlUlkesh added a commit that referenced this issue Apr 30, 2023
@AlUlkesh
Copy link
Owner

I think I found it. Can you try the latest update?

@horribleCodes
Copy link
Author

image
This time only the dropdown menu gets replaced with an error (as opposed to the Images Directory field and the dropdown menu), and the error message is different.

Traceback (most recent call last):
  File "C:\Users\source\repos\automatic\venv\lib\site-packages\gradio\routes.py", line 394, in run_predict
    output = await app.get_blocks().process_api(
  File "C:\Users\source\repos\automatic\venv\lib\site-packages\gradio\blocks.py", line 1075, in process_api
    result = await self.call_function(
  File "C:\Users\source\repos\automatic\venv\lib\site-packages\gradio\blocks.py", line 884, in call_function
    prediction = await anyio.to_thread.run_sync(
  File "C:\Users\source\repos\automatic\venv\lib\site-packages\anyio\to_thread.py", line 31, in run_sync
    return await get_asynclib().run_sync_in_worker_thread(
  File "C:\Users\source\repos\automatic\venv\lib\site-packages\anyio\_backends\_asyncio.py", line 937, in run_sync_in_worker_thread
    return await future
  File "C:\Users\source\repos\automatic\venv\lib\site-packages\anyio\_backends\_asyncio.py", line 867, in run
    result = context.run(func, *args)
  File "C:\Users\source\repos\automatic\extensions-builtin\stable-diffusion-webui-images-browser\scripts\image_browser.py", line 252, in img_path_add_remove
    selected = path_recorder[list(path_recorder.keys())[0]]["path_display"]
IndexError: list index out of range

My guess is the extension is trying to open the just deleted path? In any case, the directory still gets removed.

@AlUlkesh
Copy link
Owner

Ah. After the remove it's trying to position on the first element of the dropdown. But I think you have none left.

Not currently sure how to fix that, an empty directory gets the webui folder.

@Akossimon
Copy link

Akossimon commented Jun 18, 2024

in addition there is no reset to default folder location for outputs and database location neither.... i find myself to have to deinstall and remove it, and to re install it , just to get the default settings back again

@AlUlkesh
Copy link
Owner

in addition there is no reset to default folder location for outputs and database location neither....

The database location is fixed to the extension's top directory. I'm not sure what you mean by resetting it.

As for the folder locations, that's set by webui, not the extension.
image
Or do you mean something different?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants