Description
This error occurs because some plugins cause syntactically incorrect output, which trips up the Black formatter. However there is a workaround I've found:
From your ComfyUi directory, edit the file ./custom_nodes/comfyui-to-python-extension/comfyui_to_python.py
Just before line 413 that has final_code = black.format_str(final_code, mode=black.Mode())
, add the line
FileHandler.write_code_to_file("unformatted_comfyui_to_python_output.py", final_code)
, which will the save the file before it is formatted.
Restart comfy and try exporting.
You should see a file unformatted_comfyui_to_python_output.py
in the main directory.
Then you need to try to fix the file by hand. I use vscode with the pylance plugin (as part of the standard pythong plugin set that vscode should prompt you to install). It was very obvious to see where the issue was:
For some reason there is a random Update
in the middle. I just deleted that word and now the file works. (I have no idea why the Update
was added - I haven't spent any time debugging that part - this was a quickfix).
The error was comfing from "Join String Multi" by KJNodes. I'm not sure if it will be this easy for other errors from other plugins, but it's worth a try!