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

Error in black library breaking basic functionality #90

Open
theredwillow opened this issue Dec 13, 2024 · 2 comments
Open

Error in black library breaking basic functionality #90

theredwillow opened this issue Dec 13, 2024 · 2 comments

Comments

@theredwillow
Copy link

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

@FennelFetish
Copy link

I get the same error with a simple workflow consisting of Load Image and Preview.

The lines are a bit different:

got prompt
Prompt executed in 0.09 seconds
Traceback (most recent call last):
  File "/mnt/ai/App/ComfyUI-onediff/custom_nodes/ComfyUI-to-Python-Extension/__init__.py", line 50, in save_as_script
    ComfyUItoPython(workflow=workflow, output_file=sio)
  File "/mnt/ai/App/ComfyUI-onediff/custom_nodes/ComfyUI-to-Python-Extension/comfyui_to_python.py", line 544, in __init__
    self.execute()
  File "/mnt/ai/App/ComfyUI-onediff/custom_nodes/ComfyUI-to-Python-Extension/comfyui_to_python.py", line 573, in execute
    generated_code = code_generator.generate_workflow(
  File "/mnt/ai/App/ComfyUI-onediff/custom_nodes/ComfyUI-to-Python-Extension/comfyui_to_python.py", line 290, in generate_workflow
    final_code = self.assemble_python_code(
  File "/mnt/ai/App/ComfyUI-onediff/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 1204, in format_str
  File "src/black/__init__.py", line 1218, in _format_str_once
  File "src/black/parsing.py", line 98, in lib2to3_parse
black.parsing.InvalidInput: Cannot parse: 127:0: if __name__ == "__main__":

@EvelinaAleksiutenko
Copy link

Same for me

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

3 participants