Skip to content

Initialize failed with lastest code 267379d #134

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

Open
yorkane opened this issue Dec 16, 2024 · 11 comments
Open

Initialize failed with lastest code 267379d #134

yorkane opened this issue Dec 16, 2024 · 11 comments

Comments

@yorkane
Copy link

yorkane commented Dec 16, 2024

Cannot import /home/aigc/ComfyUI/custom_nodes/ComfyUI-IF_AI_tools module for custom nodes: cannot import name 'save_combo_settings' from 'ComfyUI-IF_AI_tools.utils' (/home/aigc/ComfyUI/custom_nodes/ComfyUI-IF_AI_tools/utils.py)

267379d

@liubin79813
Copy link

same problem

@wolfden
Copy link

wolfden commented Dec 16, 2024

ditto

ImportError: cannot import name 'save_combo_settings' from 'ComfyUI-IF_AI_tools.utils' (F:\ComfyUI\custom_nodes\ComfyUI-IF_AI_tools\utils.py)

Cannot import F:\ComfyUI\custom_nodes\ComfyUI-IF_AI_tools module for custom nodes: cannot import name 'save_combo_settings' from 'ComfyUI-IF_AI_tools.utils' (F:\ComfyUI\custom_nodes\ComfyUI-IF_AI_tools\utils.py)

@PyrateGFXProductions
Copy link

So, it's not just me...
I spent over 4 hrs last night trying to fix this error with no luck...

@jakechai
Copy link

missing utils:
missing utils

@antique-goo
Copy link

same error

@jacques42
Copy link

Same here I am sorry :(

@mkat2
Copy link

mkat2 commented Dec 17, 2024

same error...is there a solution? all happened after updating the Comfyui-if-ai_tools to the latest version.... the new file also doesnt work: 267379d

only get the node working by removing those three last save/load/create items from IFImagePromptNode.py... but is ther a good fix that can use those items??

@PyrateGFXProductions
Copy link

adding the following code to the end of utils.py fixed it for me.

def save_combo_settings(settings: Dict[str, Any], file_path: str) -> None:
    """
    Save the combo settings to a YAML file.
    
    Args:
        settings (dict): The settings to save.
        file_path (str): The path to the file where settings will be saved.
    """
    try:
        dump_yaml(settings, file_path)  # Use the existing dump_yaml function
    except Exception as e:
        logger.error(f"Error saving settings to {file_path}: {e}")

def load_combo_settings(file_path: str) -> Dict[str, Any]:
    """
    Load the combo settings from a YAML file.
    
    Args:
        file_path (str): The path to the file from which settings will be loaded.
    
    Returns:
        dict: The loaded settings.
    """
    try:
        with open(file_path, 'r') as yaml_file:
            settings = yaml.safe_load(yaml_file)
        return settings
    except FileNotFoundError:
        logger.warning(f"Settings file not found: {file_path}")
        return {}  # Return an empty dict if the file is not found
    except yaml.YAMLError as e:
        logger.error(f"Error loading YAML from the settings file: {file_path} - {e}")
        return {}

def create_settings_from_ui_IFImagePromptNode(ui_data: Dict[str, Any]) -> Dict[str, Any]:
    """
    Create settings from the UI data for the IFImagePromptNode.
    
    Args:
        ui_data (dict): The data from the UI.
    
    Returns:
        dict: The created settings.
    """
    settings = {
        'image_size': ui_data.get('image_size', (512, 512)),  # Default to 512x512
        'model': ui_data.get('model', 'default_model'),  # Default model name
        'use_mask': ui_data.get('use_mask', False),  # Default to not using a mask
        # Add more parameters as needed based on your UI
    }
    return settings

@mkat2
Copy link

mkat2 commented Dec 18, 2024

adding the following code to the end of utils.py fixed it for me.

def save_combo_settings(settings: Dict[str, Any], file_path: str) -> None:
    """
    Save the combo settings to a YAML file.
    
    Args:
        settings (dict): The settings to save.
        file_path (str): The path to the file where settings will be saved.
    """
    try:
        dump_yaml(settings, file_path)  # Use the existing dump_yaml function
    except Exception as e:
        logger.error(f"Error saving settings to {file_path}: {e}")

def load_combo_settings(file_path: str) -> Dict[str, Any]:
    """
    Load the combo settings from a YAML file.
    
    Args:
        file_path (str): The path to the file from which settings will be loaded.
    
    Returns:
        dict: The loaded settings.
    """
    try:
        with open(file_path, 'r') as yaml_file:
            settings = yaml.safe_load(yaml_file)
        return settings
    except FileNotFoundError:
        logger.warning(f"Settings file not found: {file_path}")
        return {}  # Return an empty dict if the file is not found
    except yaml.YAMLError as e:
        logger.error(f"Error loading YAML from the settings file: {file_path} - {e}")
        return {}

def create_settings_from_ui_IFImagePromptNode(ui_data: Dict[str, Any]) -> Dict[str, Any]:
    """
    Create settings from the UI data for the IFImagePromptNode.
    
    Args:
        ui_data (dict): The data from the UI.
    
    Returns:
        dict: The created settings.
    """
    settings = {
        'image_size': ui_data.get('image_size', (512, 512)),  # Default to 512x512
        'model': ui_data.get('model', 'default_model'),  # Default model name
        'use_mask': ui_data.get('use_mask', False),  # Default to not using a mask
        # Add more parameters as needed based on your UI
    }
    return settings

Yes many thanks, adding these defs at least makes the node load correctly!

@wolfden
Copy link

wolfden commented Dec 25, 2024

I take this mod is dead, always busted

@PyrateGFXProductions
Copy link

I take this mod is dead, always busted

I don't think so. The author is active and has an active Youtube channel but likely busy with other projects as he hasn't touched this in 2 weeks.

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

8 participants