gradio: FileNotFoundError: [Errno 2] No such file or directory

Describe the bug

I’m not absolutely sure, if this is here the right place (please tell me where to put it otherwise), but it’s getting now so unbelievable annoying, I have to tell somewhere since no one seems to care about it.

I’m an Automatic1111 User , A1111 uses Gradio as plattform. Since months now, it is not possible that Gradio creates directories if needed. In A1111 there is an option to define a directory for temporay files. In my case this is defined like so: T:\systemp\sd-temp-files
Now, the folder T:\systemp\ is existing. But the folder sd-temp-files will be deleted to remove those temp files. The problme now is: This sd-temp-files folder is not been created if not existing. So, every other function/extension that want to use this, get’s an error -> FileNotFoundError: [Errno 2] No such file or directory: ‘T:\systemp\sd-temp-files\tmpdycp6gra.png’

So it’s an giant urge to tell Gradio it should create directories if they are setup in the settings.

I sincerely hope that someone can finally fix this, thanks.

Is there an existing issue for this?

  • I have searched the existing issues

Reproduction

Use A1111

Screenshot

No response

Logs

Traceback (most recent call last):███████████████████████████████████████████████████| 110/110 [02:21<00:00,  2.52s/it]
  File "I:\Super SD 2.0\stable-diffusion-webui\venv\lib\site-packages\gradio\routes.py", line 394, in run_predict
    output = await app.get_blocks().process_api(
  File "I:\Super SD 2.0\stable-diffusion-webui\venv\lib\site-packages\gradio\blocks.py", line 1078, in process_api
    data = self.postprocess_data(fn_index, result["prediction"], state)
  File "I:\Super SD 2.0\stable-diffusion-webui\venv\lib\site-packages\gradio\blocks.py", line 1012, in postprocess_data
    prediction_value = block.postprocess(prediction_value)
  File "I:\Super SD 2.0\stable-diffusion-webui\venv\lib\site-packages\gradio\components.py", line 3954, in postprocess
    file = processing_utils.save_pil_to_file(img)
  File "I:\Super SD 2.0\stable-diffusion-webui\modules\ui_tempdir.py", line 52, in save_pil_to_file
    file_obj = tempfile.NamedTemporaryFile(delete=False, suffix=".png", dir=dir)
  File "F:\Programme\Python310\lib\tempfile.py", line 559, in NamedTemporaryFile
    file = _io.open(dir, mode, buffering=buffering,
  File "F:\Programme\Python310\lib\tempfile.py", line 556, in opener
    fd, name = _mkstemp_inner(dir, prefix, suffix, flags, output_type)
  File "F:\Programme\Python310\lib\tempfile.py", line 256, in _mkstemp_inner
    fd = _os.open(file, flags, 0o600)
FileNotFoundError: [Errno 2] No such file or directory: 'T:\\systemp\\sd-temp-files\\tmpdycp6gra.png'

System Info

v3.23, Win10, Firefox

Severity

serious, but I can work around it

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 17 (4 by maintainers)

Most upvoted comments

I solved the problem just by creating the missing directory.