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

[Bug]: Having a "#" character in the prompt causes a file not found exception #5271

Closed
1 task done
Zyin055 opened this issue Dec 1, 2022 · 6 comments
Closed
1 task done
Labels
bug-report Report of a bug, yet to be confirmed

Comments

@Zyin055
Copy link

Zyin055 commented Dec 1, 2022

Is there an existing issue for this?

  • I have searched the existing issues and checked the recent builds/commits

What happened?

Using a prompt that has a "#" causes the completed image to not be displayed in the image gallery. It throws a RuntimeError: File at path C:\Stuff\AI\Stable Diffusion\outputs\txt2img-images\22352-8- does not exist.

It appears that the "#" is acting like a python comment, cutting off the rest of the file name.

The file exists in my hard drive, and I can view it normally through file explorer using IrfanView.

Note that using a "#" before I updated to this version that supports SD2.0 worked a few weeks ago. That working commit was: c5334fc56b3d44976425da2e6d0a303ae96836a1. I know this because I used to use "#" as a placeholder for the X/Y Prompt S/R script.

Tested with SD2.0 model and older models.

file not found

Steps to reproduce the problem

  1. Type any prompt with a #, such as "a # beautiful woman"
  2. Press Generate button
  3. After generation completes, an image not found icon is displayed where the image preview should be

What should have happened?

Image preview should be shown in the image gallery instead of an image not found icon.

Commit where the problem happens

4b3c5bc

What platforms do you use to access UI ?

Windows

What browsers do you use to access the UI ?

Microsoft Edge

Command Line Arguments

--xformers

Additional information, context and logs

100%|████████████████████████████████████████████████████████████████████████████████████| 8/8 [00:02<00:00,  3.40it/s]
Total progress: 100%|████████████████████████████████████████████████████████████████████| 8/8 [00:02<00:00,  3.05it/s]
ERROR:    Exception in ASGI application
Traceback (most recent call last):
  File "C:\Stuff\AI\Stable Diffusion\venv\lib\site-packages\starlette\responses.py", line 331, in __call__
    stat_result = await anyio.to_thread.run_sync(os.stat, self.path)
  File "C:\Stuff\AI\Stable Diffusion\venv\lib\site-packages\anyio\to_thread.py", line 31, in run_sync
    return await get_asynclib().run_sync_in_worker_thread(
  File "C:\Stuff\AI\Stable Diffusion\venv\lib\site-packages\anyio\_backends\_asyncio.py", line 937, in run_sync_in_worker_thread
    return await future
  File "C:\Stuff\AI\Stable Diffusion\venv\lib\site-packages\anyio\_backends\_asyncio.py", line 867, in run
    result = context.run(func, *args)
FileNotFoundError: [WinError 2] The system cannot find the file specified: 'C:\\Stuff\\AI\\Stable Diffusion\\outputs\\txt2img-images\\22352-8-'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Stuff\AI\Stable Diffusion\venv\lib\site-packages\uvicorn\protocols\http\h11_impl.py", line 407, in run_asgi
    result = await app(  # type: ignore[func-returns-value]
  File "C:\Stuff\AI\Stable Diffusion\venv\lib\site-packages\uvicorn\middleware\proxy_headers.py", line 78, in __call__
    return await self.app(scope, receive, send)
  File "C:\Stuff\AI\Stable Diffusion\venv\lib\site-packages\fastapi\applications.py", line 270, in __call__
    await super().__call__(scope, receive, send)
  File "C:\Stuff\AI\Stable Diffusion\venv\lib\site-packages\starlette\applications.py", line 124, in __call__
    await self.middleware_stack(scope, receive, send)
  File "C:\Stuff\AI\Stable Diffusion\venv\lib\site-packages\starlette\middleware\errors.py", line 184, in __call__
    raise exc
  File "C:\Stuff\AI\Stable Diffusion\venv\lib\site-packages\starlette\middleware\errors.py", line 162, in __call__
    await self.app(scope, receive, _send)
  File "C:\Stuff\AI\Stable Diffusion\venv\lib\site-packages\starlette\middleware\gzip.py", line 24, in __call__
    await responder(scope, receive, send)
  File "C:\Stuff\AI\Stable Diffusion\venv\lib\site-packages\starlette\middleware\gzip.py", line 43, in __call__
    await self.app(scope, receive, self.send_with_gzip)
  File "C:\Stuff\AI\Stable Diffusion\venv\lib\site-packages\starlette\middleware\exceptions.py", line 75, in __call__
    raise exc
  File "C:\Stuff\AI\Stable Diffusion\venv\lib\site-packages\starlette\middleware\exceptions.py", line 64, in __call__
    await self.app(scope, receive, sender)
  File "C:\Stuff\AI\Stable Diffusion\venv\lib\site-packages\fastapi\middleware\asyncexitstack.py", line 21, in __call__
    raise e
  File "C:\Stuff\AI\Stable Diffusion\venv\lib\site-packages\fastapi\middleware\asyncexitstack.py", line 18, in __call__
    await self.app(scope, receive, send)
  File "C:\Stuff\AI\Stable Diffusion\venv\lib\site-packages\starlette\routing.py", line 680, in __call__
    await route.handle(scope, receive, send)
  File "C:\Stuff\AI\Stable Diffusion\venv\lib\site-packages\starlette\routing.py", line 275, in handle
    await self.app(scope, receive, send)
  File "C:\Stuff\AI\Stable Diffusion\venv\lib\site-packages\starlette\routing.py", line 68, in app
    await response(scope, receive, send)
  File "C:\Stuff\AI\Stable Diffusion\venv\lib\site-packages\starlette\responses.py", line 334, in __call__
    raise RuntimeError(f"File at path {self.path} does not exist.")
RuntimeError: File at path C:\Stuff\AI\Stable Diffusion\outputs\txt2img-images\22352-8- does not exist.
@Zyin055 Zyin055 added the bug-report Report of a bug, yet to be confirmed label Dec 1, 2022
@ClashSAN ClashSAN changed the title [Bug]: [Bug]: Using "#" as a placeholder for the X/Y Prompt S/R no longer working Dec 1, 2022
@Zyin055
Copy link
Author

Zyin055 commented Dec 1, 2022

Not sure why the issue name was changed since this occurs without any script running. I don't believe the X/Y script is causing it - it was just an example use case for using the # character.

@ClashSAN
Copy link
Collaborator

ClashSAN commented Dec 1, 2022

sure, change it, it had no title before

@Zyin055 Zyin055 changed the title [Bug]: Using "#" as a placeholder for the X/Y Prompt S/R no longer working [Bug]: Having a "#" character in the prompt causes a file not found exception Dec 1, 2022
@Zyin055
Copy link
Author

Zyin055 commented Dec 1, 2022

Oh, I must have forgot to enter one. My bad

@DmytroSokhach
Copy link

I've got the same issue by trying the prompts from Aesthetic Gradients:
https://github.com/vicgalle/stable-diffusion-aesthetic-gradients

Tried in UI (quotes for clarity):
"Roman city on top of a ridge, sci-fi illustration by Greg Rutkowski #sci-fi detailed vivid colors gothic concept illustration by James Gurney and Zdzislaw Beksiński vivid vivid colorsg concept illustration colorful interior"

gives:
raise RuntimeError(f"File at path {self.path} does not exist.")


I read in another thread that "round brackets are from Stable Diffusion" and "curly brackets are from NovelAI"
Is that similar case for # symbol in prompts?

@AlUlkesh
Copy link
Contributor

AlUlkesh commented Jan 2, 2023

I read in another thread that "round brackets are from Stable Diffusion" and "curly brackets are from NovelAI" Is that similar case for # symbol in prompts?

What does # do in NovelAI?

@mezotaken
Copy link
Collaborator

This issue was created earlier, but i already rerouted most of them here, so... #6599

@mezotaken mezotaken closed this as not planned Won't fix, can't repro, duplicate, stale Jan 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug-report Report of a bug, yet to be confirmed
Projects
None yet
Development

No branches or pull requests

5 participants