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

AttributeError: module 'os' has no attribute 'startfile' #25

Open
wangier opened this issue Dec 27, 2024 · 6 comments
Open

AttributeError: module 'os' has no attribute 'startfile' #25

wangier opened this issue Dec 27, 2024 · 6 comments

Comments

@wangier
Copy link

wangier commented Dec 27, 2024

on Ubuntu, while the open folder button was clicked, it did nothing, and an error was printed in the terminal, as below shown. Seems the scripts does not consider platform difference for this feature.

Traceback (most recent call last): File "/home/u01/stable-diffusion-webui/venv/lib/python3.10/site-packages/gradio/routes.py", line 488, in run_predict output = await app.get_blocks().process_api( File "/home/u01/stable-diffusion-webui/venv/lib/python3.10/site-packages/gradio/blocks.py", line 1431, in process_api result = await self.call_function( File "/home/u01/stable-diffusion-webui/venv/lib/python3.10/site-packages/gradio/blocks.py", line 1103, in call_function prediction = await anyio.to_thread.run_sync( File "/home/u01/stable-diffusion-webui/venv/lib/python3.10/site-packages/anyio/to_thread.py", line 33, in run_sync return await get_asynclib().run_sync_in_worker_thread( File "/home/u01/stable-diffusion-webui/venv/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 877, in run_sync_in_worker_thread return await future File "/home/u01/stable-diffusion-webui/venv/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 807, in run result = context.run(func, *args) File "/home/u01/stable-diffusion-webui/venv/lib/python3.10/site-packages/gradio/utils.py", line 707, in wrapper response = f(*args, **kwargs) File "/home/u01/stable-diffusion-webui/extensions/sd-webui-traintrain/scripts/traintrain.py", line 392, in openfolder_f os.startfile(jsonspath) AttributeError: module 'os' has no attribute 'startfile'

hako-mikan added a commit that referenced this issue Jan 9, 2025
@hako-mikan
Copy link
Owner

Fixed.

@wangier
Copy link
Author

wangier commented Jan 10, 2025

Thaks for your work. @hako-mikan
After pull the latest commit, no error is printed while open folder button clicked, under Ubuntu.
However, it just opens a files explorer. No select button in the poped-up files explorer. Hence the target file could not be selected.
If I input the target file path into inputbox directly, and click the "apply" button, there are many error boxes poped up on every inputbox. In the terminal, the below information was printed out:

Traceback (most recent call last):
File "/home/u01/stable-diffusion-webui/venv/lib/python3.10/site-packages/gradio/routes.py", line 488, in run_predict
output = await app.get_blocks().process_api(
File "/home/u01/stable-diffusion-webui/venv/lib/python3.10/site-packages/gradio/blocks.py", line 1434, in process_api
data = self.postprocess_data(fn_index, result["prediction"], state)
File "/home/u01/stable-diffusion-webui/venv/lib/python3.10/site-packages/gradio/blocks.py", line 1297, in postprocess_data
self.validate_outputs(fn_index, predictions) # type: ignore
File "/home/u01/stable-diffusion-webui/venv/lib/python3.10/site-packages/gradio/blocks.py", line 1272, in validate_outputs
raise ValueError(
ValueError: An event handler (import_json) didn't receive enough output values (needed: 101, received: 48).
Wanted outputs:
[radio, dropdown, dropdown, dropdown, dropdown, dropdown, textbox, textbox, textbox, textbox, textbox, textbox, dropdown, textbox, dropdown, textbox, textbox, checkbox, checkboxgroup, dropdown, dropdown, dropdown, dropdown, textbox, textbox, textbox, checkbox, checkbox, checkbox, checkbox, checkbox, textbox, textbox, textbox, textbox, textbox, textbox, textbox, textbox, dropdown, dropdown, dropdown, textbox, checkbox, checkbox, checkbox, checkbox, checkbox, checkbox, checkbox, checkbox, dropdown, dropdown, dropdown, textbox, textbox, textbox, textbox, textbox, textbox, dropdown, textbox, dropdown, textbox, textbox, checkbox, checkboxgroup, dropdown, dropdown, dropdown, dropdown, textbox, textbox, textbox, checkbox, checkbox, checkbox, checkbox, checkbox, textbox, textbox, textbox, textbox, textbox, textbox, textbox, textbox, dropdown, dropdown, dropdown, textbox, checkbox, checkbox, checkbox, checkbox, checkbox, checkbox, checkbox, checkbox, textbox, textbox]
Received outputs:
[{'type': 'generic_update'}, {'type': 'generic_update'}, {'type': 'generic_update'}, {'type': 'generic_update'}, {'type': 'generic_update'}, {'type': 'generic_update'}, {'type': 'generic_update'}, {'type': 'generic_update'}, {'type': 'generic_update'}, {'type': 'generic_update'}, {'type': 'generic_update'}, {'type': 'generic_update'}, {'type': 'generic_update'}, {'type': 'generic_update'}, {'type': 'generic_update'}, {'type': 'generic_update'}, {'type': 'generic_update'}, {'type': 'generic_update'}, {'type': 'generic_update'}, {'type': 'generic_update'}, {'type': 'generic_update'}, {'type': 'generic_update'}, {'type': 'generic_update'}, {'type': 'generic_update'}, {'type': 'generic_update'}, {'type': 'generic_update'}, {'type': 'generic_update'}, {'type': 'generic_update'}, {'type': 'generic_update'}, {'type': 'generic_update'}, {'type': 'generic_update'}, {'type': 'generic_update'}, {'type': 'generic_update'}, {'type': 'generic_update'}, {'type': 'generic_update'}, {'type': 'generic_update'}, {'type': 'generic_update'}, {'type': 'generic_update'}, {'type': 'generic_update'}, {'type': 'generic_update'}, {'type': 'generic_update'}, {'type': 'generic_update'}, {'type': 'generic_update'}, {'type': 'generic_update'}, {'type': 'generic_update'}, {'type': 'generic_update'}, {'type': 'generic_update'}, {'type': 'generic_update'}]

image

@hako-mikan
Copy link
Owner

That button is not for selecting files but for opening folders, so it's working as intended.
Selecting files isn’t possible due to Gradio’s limitations.
Please only input the file name in that text box; it doesn’t matter whether “.json” is included or not.

@wangier
Copy link
Author

wangier commented Jan 14, 2025

That button is not for selecting files but for opening folders, so it's working as intended. Selecting files isn’t possible due to Gradio’s limitations. Please only input the file name in that text box; it doesn’t matter whether “.json” is included or not.

Thanks for your reply.

What can I do for the "apply" issue? After target file path inputed into the text box, when I clicked the "apply" button, many error boxes poped up on every inputbox. In the terminal, the below information was printed out:

Traceback (most recent call last):
File "/home/u01/stable-diffusion-webui/venv/lib/python3.10/site-packages/gradio/routes.py", line 488, in run_predict
output = await app.get_blocks().process_api(
File "/home/u01/stable-diffusion-webui/venv/lib/python3.10/site-packages/gradio/blocks.py", line 1434, in process_api
data = self.postprocess_data(fn_index, result["prediction"], state)
File "/home/u01/stable-diffusion-webui/venv/lib/python3.10/site-packages/gradio/blocks.py", line 1297, in postprocess_data
self.validate_outputs(fn_index, predictions) # type: ignore
File "/home/u01/stable-diffusion-webui/venv/lib/python3.10/site-packages/gradio/blocks.py", line 1272, in validate_outputs
raise ValueError(
ValueError: An event handler (import_json) didn't receive enough output values (needed: 101, received: 48).
Wanted outputs:
[radio, dropdown, dropdown, dropdown, dropdown, dropdown, textbox, textbox, textbox, textbox, textbox, textbox, dropdown, textbox, dropdown, textbox, textbox, checkbox, checkboxgroup, dropdown, dropdown, dropdown, dropdown, textbox, textbox, textbox, checkbox, checkbox, checkbox, checkbox, checkbox, textbox, textbox, textbox, textbox, textbox, textbox, textbox, textbox, dropdown, dropdown, dropdown, textbox, checkbox, checkbox, checkbox, checkbox, checkbox, checkbox, checkbox, checkbox, dropdown, dropdown, dropdown, textbox, textbox, textbox, textbox, textbox, textbox, dropdown, textbox, dropdown, textbox, textbox, checkbox, checkboxgroup, dropdown, dropdown, dropdown, dropdown, textbox, textbox, textbox, checkbox, checkbox, checkbox, checkbox, checkbox, textbox, textbox, textbox, textbox, textbox, textbox, textbox, textbox, dropdown, dropdown, dropdown, textbox, checkbox, checkbox, checkbox, checkbox, checkbox, checkbox, checkbox, checkbox, textbox, textbox]
Received outputs:
[{'type': 'generic_update'}, {'type': 'generic_update'}, {'type': 'generic_update'}, {'type': 'generic_update'}, {'type': 'generic_update'}, {'type': 'generic_update'}, {'type': 'generic_update'}, {'type': 'generic_update'}, {'type': 'generic_update'}, {'type': 'generic_update'}, {'type': 'generic_update'}, {'type': 'generic_update'}, {'type': 'generic_update'}, {'type': 'generic_update'}, {'type': 'generic_update'}, {'type': 'generic_update'}, {'type': 'generic_update'}, {'type': 'generic_update'}, {'type': 'generic_update'}, {'type': 'generic_update'}, {'type': 'generic_update'}, {'type': 'generic_update'}, {'type': 'generic_update'}, {'type': 'generic_update'}, {'type': 'generic_update'}, {'type': 'generic_update'}, {'type': 'generic_update'}, {'type': 'generic_update'}, {'type': 'generic_update'}, {'type': 'generic_update'}, {'type': 'generic_update'}, {'type': 'generic_update'}, {'type': 'generic_update'}, {'type': 'generic_update'}, {'type': 'generic_update'}, {'type': 'generic_update'}, {'type': 'generic_update'}, {'type': 'generic_update'}, {'type': 'generic_update'}, {'type': 'generic_update'}, {'type': 'generic_update'}, {'type': 'generic_update'}, {'type': 'generic_update'}, {'type': 'generic_update'}, {'type': 'generic_update'}, {'type': 'generic_update'}, {'type': 'generic_update'}, {'type': 'generic_update'}]

image

@hako-mikan
Copy link
Owner

Enter only the file name, not the full path.

@wangier
Copy link
Author

wangier commented Jan 20, 2025

Enter only the file name, not the full path.

Thanks.
Changed to only file name in putbox, while clicking the apply button, there is somthing new in the logs, as below:

Traceback (most recent call last):
File "/home/u01/stable-diffusion-webui/venv/lib/python3.10/site-packages/gradio/routes.py", line 488, in run_predict
output = await app.get_blocks().process_api(
File "/home/u01/stable-diffusion-webui/venv/lib/python3.10/site-packages/gradio/blocks.py", line 1431, in process_api
result = await self.call_function(
File "/home/u01/stable-diffusion-webui/venv/lib/python3.10/site-packages/gradio/blocks.py", line 1103, in call_function
prediction = await anyio.to_thread.run_sync(
File "/home/u01/stable-diffusion-webui/venv/lib/python3.10/site-packages/anyio/to_thread.py", line 33, in run_sync
return await get_asynclib().run_sync_in_worker_thread(
File "/home/u01/stable-diffusion-webui/venv/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 877, in run_sync_in_worker_thread
return await future
File "/home/u01/stable-diffusion-webui/venv/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 807, in run
result = context.run(func, *args)
File "/home/u01/stable-diffusion-webui/venv/lib/python3.10/site-packages/gradio/utils.py", line 707, in wrapper
response = f(*args, **kwargs)
File "/home/u01/stable-diffusion-webui/extensions/sd-webui-traintrain/trainer/trainer.py", line 227, in import_json
setconfigs(data, output)
File "/home/u01/stable-diffusion-webui/extensions/sd-webui-traintrain/trainer/trainer.py", line 212, in setconfigs
from scripts.traintrain import OPTIMIZERS
ModuleNotFoundError: No module named 'scripts.traintrain'

Image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants