lks-ai / anynode

A Node for ComfyUI that does what you ask it to do
MIT License
426 stars 27 forks source link

Error occurred when executing AnyNode: Syntax error in code: invalid syntax (, line 1) #11

Open Cokeheart opened 1 month ago

Cokeheart commented 1 month ago

File "D:\ComfyUI-aki-v1.3\execution.py", line 151, in recursive_execute output_data, output_ui = get_output_data(obj, input_data_all) File "D:\ComfyUI-aki-v1.3\execution.py", line 81, in get_output_data return_values = map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True) File "D:\ComfyUI-aki-v1.3\execution.py", line 74, in map_node_over_list results.append(getattr(obj, func)(**slice_dict(input_data_all, i))) File "D:\ComfyUI-aki-v1.3\custom_nodes\anynode\nodes\any.py", line 320, in go raise e File "D:\ComfyUI-aki-v1.3\custom_nodes\anynode\nodes\any.py", line 315, in go self.safe_exec(self.script, globals_dict, locals_dict) File "D:\ComfyUI-aki-v1.3\custom_nodes\anynode\nodes\any.py", line 277, in safe_exec raise e File "D:\ComfyUI-aki-v1.3\custom_nodes\anynode\nodes\any.py", line 273, in safe_exec exec(sanitize_code(code_string), globals_dict, locals_dict) File "D:\ComfyUI-aki-v1.3\custom_nodes\anynode\nodes\utils.py", line 199, in sanitize_code raise ValueError(f"Syntax error in code: {e}")

lks-ai commented 1 month ago

Press Queue Prompt Again.

Also, could you provide the output for the function? It should be right above that.

lks-ai commented 4 weeks ago

So, In talking to other users with the same error I thought I'd fixed, I realized this might be a problem with the LLM itself.

In one user's case, using GPT4All, he was having cutoff problems where the LLM would start writing the function, and then get cut off in the middle even though his context length was definitely long enough.

I've got an eye on the bug. Anyone else having it, perhaps you could shed some more insight?

blueraincoatli commented 4 weeks ago

I got same problem, I use ollama as the loacal LLM, It works properly in ImpactFrames (IF prompt to prompt) node


Error occurred when executing AnyNode:

invalid syntax (, line 1)

File "E:\ComfyUI_windows_portable\ComfyUI\execution.py", line 151, in recursive_execute
output_data, output_ui = get_output_data(obj, input_data_all)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "E:\ComfyUI_windows_portable\ComfyUI\execution.py", line 81, in get_output_data
return_values = map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "E:\ComfyUI_windows_portable\ComfyUI\execution.py", line 74, in map_node_over_list
results.append(getattr(obj, func)(**slice_dict(input_data_all, i)))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "E:\ComfyUI_windows_portable\ComfyUI\custom_nodes\anynode-main\nodes\any.py", line 219, in go
raise e
File "E:\ComfyUI_windows_portable\ComfyUI\custom_nodes\anynode-main\nodes\any.py", line 211, in go
self.safe_exec(self.script, globals_dict, locals_dict)
File "E:\ComfyUI_windows_portable\ComfyUI\custom_nodes\anynode-main\nodes\any.py", line 184, in safe_exec
raise e
File "E:\ComfyUI_windows_portable\ComfyUI\custom_nodes\anynode-main\nodes\any.py", line 180, in safe_exec
exec(code_string, globals_dict, locals_dict)
blueraincoatli commented 4 weeks ago

I did more tests, the default node of Local LLM will work if I only connect the input and output node, but when I edit the prompt, It will get error like below, even I paste the default prompt "Take the input and multiply by 5",

!!! Exception during processing!!! unterminated string literal (detected at line 1) (<string>, line 1)
Traceback (most recent call last):
  File "E:\ComfyUI_windows_portable\ComfyUI\execution.py", line 151, in recursive_execute
    output_data, output_ui = get_output_data(obj, input_data_all)
                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\ComfyUI_windows_portable\ComfyUI\execution.py", line 81, in get_output_data
    return_values = map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\ComfyUI_windows_portable\ComfyUI\execution.py", line 74, in map_node_over_list
    results.append(getattr(obj, func)(**slice_dict(input_data_all, i)))
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\ComfyUI_windows_portable\ComfyUI\custom_nodes\anynode-main\nodes\any.py", line 219, in go
    raise e
  File "E:\ComfyUI_windows_portable\ComfyUI\custom_nodes\anynode-main\nodes\any.py", line 211, in go
    self.safe_exec(self.script, globals_dict, locals_dict)
  File "E:\ComfyUI_windows_portable\ComfyUI\custom_nodes\anynode-main\nodes\any.py", line 184, in safe_exec
    raise e
  File "E:\ComfyUI_windows_portable\ComfyUI\custom_nodes\anynode-main\nodes\any.py", line 180, in safe_exec
    exec(code_string, globals_dict, locals_dict)
  File "<string>", line 1
    Here's the updated code:
        ^
SyntaxError: unterminated string literal (detected at line 1)
zhaowtVincent commented 4 weeks ago

RUN-24 gemini-1.5-flash I want you to output the image with an hue rotation by random degrees between 0 and 359 and tweaks the saturation and lightness drastically.

Use the current system time as the random seed. Output should be a tensor the same shape as input. tensor([[[[0.5765, 0.5804, 0.4941], [0.5922, 0.5922, 0.5098], [0.5922, 0.5922, 0.5098], ..., [1.0000, 1.0000, 1.0000], [1.0000, 1.0000, 1.0000], [1.0000, 1.0000, 1.0000]],

     [[0.5490, 0.5529, 0.4745],
      [0.5490, 0.5529, 0.4745],
      [0.5490, 0.5529, 0.4745],
      ...,
      [1.0000, 1.0000, 1.0000],
      [1.0000, 1.0000, 1.0000],
      [1.0000, 1.0000, 1.0000]],

     [[0.5490, 0.5529, 0.4745],
      [0.5490, 0.5529, 0.4745],
      [0.5490, 0.5529, 0.4745],
      ...,
      [1.0000, 1.0000, 1.0000],
      [1.0000, 1.0000, 1.0000],
      [1.0000, 1.0000, 1.0000]],

     ...,

     [[0.5490, 0.5569, 0.5294],
      [0.5569, 0.5686, 0.5412],
      [0.5569, 0.5686, 0.5412],
      ...,
      [1.0000, 1.0000, 1.0000],
      [1.0000, 1.0000, 1.0000],
      [1.0000, 1.0000, 1.0000]],

     [[0.5490, 0.5569, 0.5294],
      [0.5569, 0.5686, 0.5412],
      [0.5569, 0.5686, 0.5412],
      ...,
      [1.0000, 1.0000, 1.0000],
      [1.0000, 1.0000, 1.0000],
      [1.0000, 1.0000, 1.0000]],

     [[0.5569, 0.5608, 0.5373],
      [0.5529, 0.5608, 0.5373],
      [0.5529, 0.5608, 0.5373],
      ...,
      [1.0000, 1.0000, 1.0000],
      [1.0000, 1.0000, 1.0000],
      [1.0000, 1.0000, 1.0000]]]]) None

Finding Nodes in Workspace. kwargs: {'id': '24'} {'prompt': 'I want you to output the image with an hue rotation by random degrees between 0 and 359 and tweaks the saturation and lightness drastically.\n\nUse the current system time as the random seed. Output should be a tensor the same shape as input.', 'function': 'An error occurred: Your default credentials were not found. To set up Application Default Credentials, see https://cloud.google.com/docs/authentication/external/set-up-adc for more information.', 'imports': '', 'comment': None, 'input_types': "Type: <class 'torch.Tensor'>, Shape: (1, 707, 741, 3), Dtype: torch.float32\nType: <class 'NoneType'>", 'version': '0.1.2'} 2024-06-05 11:25:56,465- root:179- ERROR- !!! Exception during processing!!! Expected metadata value to be a str, int, float or bool, got None which is a NoneType 2024-06-05 11:25:56,467- root:180- ERROR- Traceback (most recent call last): File "K:\software\ComfyU\ComfyUI_windows_portable_nvidia_cu121_or_cpu\ComfyUI_windows_portable\ComfyUI\execution.py", line 151, in recursive_execute output_data, output_ui = get_output_data(obj, input_data_all) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "K:\software\ComfyU\ComfyUI_windows_portable_nvidia_cu121_or_cpu\ComfyUI_windows_portable\ComfyUI\execution.py", line 81, in get_output_data return_values = map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "K:\software\ComfyU\ComfyUI_windows_portable_nvidia_cu121_or_cpu\ComfyUI_windows_portable\ComfyUI\execution.py", line 74, in map_node_over_list results.append(getattr(obj, func)(**slice_dict(input_data_all, i))) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "K:\software\ComfyU\ComfyUI_windows_portable_nvidia_cu121_or_cpu\ComfyUI_windows_portable\ComfyUI\custom_nodes\anynode\nodes\any.py", line 404, in go registry.add_function(prompt, self.script, self.imports, self.last_comment, [variable_info(any), variable_info(any2)]) File "K:\software\ComfyU\ComfyUI_windows_portable_nvidia_cu121_or_cpu\ComfyUI_windows_portable\ComfyUI\custom_nodes\anynode\nodes\util_functions.py", line 57, in add_function self.add_function_to_chromadb(prompt_hash, prompt, function_code, imports, comment, input_types) File "K:\software\ComfyU\ComfyUI_windows_portable_nvidia_cu121_or_cpu\ComfyUI_windows_portable\ComfyUI\custom_nodes\anynode\nodes\util_functions.py", line 85, in add_function_to_chromadb collection.add( File "K:\software\ComfyU\ComfyUI_windows_portable_nvidia_cu121_or_cpu\ComfyUI_windows_portable\python_embeded\Lib\site-packages\chromadb\api\models\Collection.py", line 146, in add ) = self._validate_embedding_set( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "K:\software\ComfyU\ComfyUI_windows_portable_nvidia_cu121_or_cpu\ComfyUI_windows_portable\python_embeded\Lib\site-packages\chromadb\api\models\Collection.py", line 554, in _validate_embedding_set validate_metadatas(maybe_cast_one_to_many_metadata(metadatas)) File "K:\software\ComfyU\ComfyUI_windows_portable_nvidia_cu121_or_cpu\ComfyUI_windows_portable\python_embeded\Lib\site-packages\chromadb\api\types.py", line 316, in validate_metadatas validate_metadata(metadata) File "K:\software\ComfyU\ComfyUI_windows_portable_nvidia_cu121_or_cpu\ComfyUI_windows_portable\python_embeded\Lib\site-packages\chromadb\api\types.py", line 282, in validate_metadata raise ValueError( ValueError: Expected metadata value to be a str, int, float or bool, got None which is a NoneType

2024-06-05 11:25:56,470- root:124- INFO- Prompt executed in 0.05 seconds

EminenceNoir commented 3 weeks ago

Press Queue Prompt Again.

Also, could you provide the output for the function? It should be right above that.

ValueError 802 AnyNodeLocal

Error occurred when executing AnyNodeLocal:

Syntax error in code: invalid syntax (, line 1)

File "E:\ComfyUI\ComfyUI\execution.py", line 151, in recursive_execute
output_data, output_ui = get_output_data(obj, input_data_all)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "E:\ComfyUI\ComfyUI\execution.py", line 81, in get_output_data
return_values = map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "E:\ComfyUI\ComfyUI\execution.py", line 74, in map_node_over_list
results.append(getattr(obj, func)(**slice_dict(input_data_all, i)))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "E:\ComfyUI\ComfyUI\custom_nodes\anynode\nodes\any.py", line 384, in go
raise e
File "E:\ComfyUI\ComfyUI\custom_nodes\anynode\nodes\any.py", line 378, in go
self.safe_exec(modified_script, globals_dict, locals_dict)
File "E:\ComfyUI\ComfyUI\custom_nodes\anynode\nodes\any.py", line 322, in safe_exec
raise e
File "E:\ComfyUI\ComfyUI\custom_nodes\anynode\nodes\any.py", line 318, in safe_exec
exec(sanitize_code(code_string), globals_dict, locals_dict)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "E:\ComfyUI\ComfyUI\custom_nodes\anynode\nodes\utils.py", line 199, in sanitize_code
raise ValueError(f"Syntax error in code: {e}")

EDIT: I don't know what changed but it spontaneously worked just now.

aiwonderful commented 3 weeks ago

Error occurred when executing AnyNode:

Syntax error in code: invalid syntax (, line 1)

File "F:\ComfyUI_windows_portable\ComfyUI\execution.py", line 151, in recursive_execute output_data, output_ui = get_output_data(obj, input_data_all) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "F:\ComfyUI_windows_portable\ComfyUI\execution.py", line 81, in get_output_data return_values = map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "F:\ComfyUI_windows_portable\ComfyUI\execution.py", line 74, in map_node_over_list results.append(getattr(obj, func)(**slice_dict(input_data_all, i))) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "F:\ComfyUI_windows_portable\ComfyUI\custom_nodes\anynode\nodes\any.py", line 384, in go raise e File "F:\ComfyUI_windows_portable\ComfyUI\custom_nodes\anynode\nodes\any.py", line 378, in go self.safe_exec(modified_script, globals_dict, locals_dict) File "F:\ComfyUI_windows_portable\ComfyUI\custom_nodes\anynode\nodes\any.py", line 322, in safe_exec raise e File "F:\ComfyUI_windows_portable\ComfyUI\custom_nodes\anynode\nodes\any.py", line 318, in safe_exec exec(sanitize_code(code_string), globals_dict, locals_dict) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "F:\ComfyUI_windows_portable\ComfyUI\custom_nodes\anynode\nodes\utils.py", line 199, in sanitize_code raise ValueError(f"Syntax error in code: {e}")