|
2 | 2 | import glob |
3 | 3 | import inspect |
4 | 4 | import json |
5 | | -import logging |
6 | 5 | import os |
7 | 6 | import random |
8 | 7 | import sys |
|
11 | 10 |
|
12 | 11 | import black |
13 | 12 |
|
14 | | -sys.path.append('../') |
15 | 13 |
|
16 | | -try: |
17 | | - from utils import import_custom_nodes, find_path, add_comfyui_directory_to_sys_path, add_extra_model_paths, get_value_at_index |
18 | | -except ImportError: |
19 | | - sys.path.append('.') |
20 | | - from utils import import_custom_nodes, find_path, add_comfyui_directory_to_sys_path, add_extra_model_paths, get_value_at_index |
| 14 | +from utils import import_custom_nodes, find_path, add_comfyui_directory_to_sys_path, add_extra_model_paths, get_value_at_index |
21 | 15 |
|
| 16 | +sys.path.append('../') |
22 | 17 | from nodes import NODE_CLASS_MAPPINGS |
23 | 18 |
|
24 | 19 |
|
25 | | -logging.basicConfig(level=logging.INFO) |
26 | | - |
27 | | - |
28 | 20 | class FileHandler: |
29 | 21 | """Handles reading and writing files. |
30 | 22 |
|
@@ -311,10 +303,10 @@ def assemble_python_code(self, import_statements: set, speical_functions_code: L |
311 | 303 | """ |
312 | 304 | # Get the source code of the utils functions as a string |
313 | 305 | func_strings = [] |
314 | | - for func in [find_path, add_comfyui_directory_to_sys_path, add_extra_model_paths, get_value_at_index]: |
| 306 | + for func in [get_value_at_index, find_path, add_comfyui_directory_to_sys_path, add_extra_model_paths]: |
315 | 307 | func_strings.append(f'\n{inspect.getsource(func)}') |
316 | 308 | # Define static import statements required for the script |
317 | | - static_imports = ['import os', 'import random', 'from pathlib import Path', 'import sys', 'from typing import Sequence, Mapping, Any, Union', |
| 309 | + static_imports = ['import os', 'import random', 'import sys', 'from typing import Sequence, Mapping, Any, Union', |
318 | 310 | 'import torch'] + func_strings + ['\n\nadd_comfyui_directory_to_sys_path()\nadd_extra_model_paths()\n'] |
319 | 311 | # Check if custom nodes should be included |
320 | 312 | if custom_nodes: |
|
0 commit comments