AIrjen/OneButtonPrompt

Unable to start, syntax error

Closed this issue · 1 comments

I've installed this script on the latest Automatic1111 as well as the commit before the March 25'th updates, I'm seeing the following error on both:

Error loading script: onebuttonprompt.py
Traceback (most recent call last):
  File "/home/zetaphor/stable-diffusion-webui-latest/modules/scripts.py", line 256, in load_scripts
    script_module = script_loading.load_module(scriptfile.path)
  File "/home/zetaphor/stable-diffusion-webui-latest/modules/script_loading.py", line 11, in load_module
    module_spec.loader.exec_module(module)
  File "<frozen importlib._bootstrap_external>", line 850, in exec_module
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "/home/zetaphor/stable-diffusion-webui-latest/extensions/OneButtonPrompt/scripts/onebuttonprompt.py", line 10, in <module>
    from build_dynamic_prompt import *
  File "/home/zetaphor/stable-diffusion-webui-latest/extensions/OneButtonPrompt/build_dynamic_prompt.py", line 383
    match random.choice(backgroundtype):
          ^
SyntaxError: invalid syntax
AIrjen commented

Hi thanks for reporting this! I got the same issue reported on reddit as well.
It's to do with the match statement, not being recognized in all python versions.

So in order to solve, I've rewritten this part to just use normal if statements. It should work now! You can get the latest version from github.

If there is anything else, please let me know.