Skip to content

Error in black library breaking basic functionality #90

Open
@theredwillow

Description

@theredwillow

I have been unable to use this extension at all so far. Thought I should report this problem as I can't find any issues related to the black library in this repo and this is the very basic functionality.

Traceback (most recent call last):
  File "C:\Users\there\OneDrive\Documents\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-to-Python-Extension\__init__.py", line 50, in save_as_script
    ComfyUItoPython(workflow=workflow, output_file=sio)
  File "C:\Users\there\OneDrive\Documents\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-to-Python-Extension\comfyui_to_python.py", line 544, in __init__
    self.execute()
  File "C:\Users\there\OneDrive\Documents\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-to-Python-Extension\comfyui_to_python.py", line 573, in execute
    generated_code = code_generator.generate_workflow(
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\there\OneDrive\Documents\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-to-Python-Extension\comfyui_to_python.py", line 290, in generate_workflow
    final_code = self.assemble_python_code(
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\there\OneDrive\Documents\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-to-Python-Extension\comfyui_to_python.py", line 413, in assemble_python_code
    final_code = black.format_str(final_code, mode=black.Mode())
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "src\black\__init__.py", line 1225, in format_str
  File "src\black\__init__.py", line 1239, in _format_str_once
  File "src\black\parsing.py", line 90, in lib2to3_parse
black.parsing.InvalidInput: Cannot parse: 137:0: if __name__ == "__main__":

I have done a very basic search to try and figure out what's happening, but haven't dove into your code much yet. Thought I should put this out there for your contributors in case this was something someone would be more fluent in.

Here's a search result that appears to express the same concerns.
psf/black#2442

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions