WASasquatch / was-node-suite-comfyui

An extensive node suite for ComfyUI with over 210 new nodes
MIT License
1.21k stars 177 forks source link

Import Failed after updating ComfyUI #430

Open CHollman82 opened 4 months ago

CHollman82 commented 4 months ago

Traceback (most recent call last):

File "F:\SD\Data\Packages\ComfyUI\nodes.py", line 1906, in load_custom_node module_spec.loader.exec_module(module)

File "<frozen importlib._bootstrap_external>", line 883, in exec_module

File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed

File "F:\SD\Data\Packages\ComfyUI\custom_nodes\was-node-suite-comfyui\__init__.py", line 1, in <module> from .WAS_Node_Suite import NODE_CLASS_MAPPINGS

File "F:\SD\Data\Packages\ComfyUI\custom_nodes\was-node-suite-comfyui\WAS_Node_Suite.py", line 821, in <module> WDB = WASDatabase(WAS_DATABASE)

File "F:\SD\Data\Packages\ComfyUI\custom_nodes\was-node-suite-comfyui\WAS_Node_Suite.py", line 753, in __init__ self.data = json.load(f)

File "json\__init__.py", line 293, in load

File "json\__init__.py", line 346, in loads

File "json\decoder.py", line 337, in decode

File "json\decoder.py", line 355, in raw_decode

json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

Cannot import F:\SD\Data\Packages\ComfyUI\custom_nodes\was-node-suite-comfyui module for custom nodes: Expecting value: line 1 column 1 (char 0)

Joir-Jio commented 1 month ago

find this file: custom_nodes\was-node-suite-comfyui\WAS_Node_Suite.py change like this, i solved it



class WASDatabase:
    """
    The WAS Suite Database Class provides a simple key-value database that stores
    data in a flatfile using the JSON format. Each key-value pair is associated with
    a category.

    Attributes:
        filepath (str): The path to the JSON file where the data is stored.
        data (dict): The dictionary that holds the data read from the JSON file.

    Methods:
        insert(category, key, value): Inserts a key-value pair into the database
            under the specified category.
        get(category, key): Retrieves the value associated with the specified
            key and category from the database.
        update(category, key): Update a value associated with the specified
            key and category from the database.
        delete(category, key): Deletes the key-value pair associated with the
            specified key and category from the database.
        _save(): Saves the current state of the database to the JSON file.
    """
    # def __init__(self, filepath):
    #     self.filepath = filepath
    #     try:
    #         with open(filepath, 'r') as f:
    #             self.data = json.load(f)
    #             print(json.dumps(self.data, indent=4, ensure_ascii=False))
    #     except FileNotFoundError:
    #         self.data = {}
    def __init__(self, filepath):
        self.filepath = filepath
        try:
            with open(filepath, 'r') as f:
                content = f.read().strip()
                if content:
                    self.data = json.loads(content)
                else:
                    self.data = {}
                print(json.dumps(self.data, indent=4, ensure_ascii=False))
        except FileNotFoundError:
            self.data = {}
        except json.JSONDecodeError as e:
            cstr(f"JSON error: {str(e)}").error.print()
            self.data = {}
WASasquatch commented 1 month ago

The issue is your config was corrupted. You just needed to back it up and delete it.

On Wed, Oct 9, 2024, 7:19 PM leShu @.***> wrote:

find this file: custom_nodes\was-node-suite-comfyui\WAS_Node_Suite.py change like this, i solved it

class WASDatabase: """ The WAS Suite Database Class provides a simple key-value database that stores data in a flatfile using the JSON format. Each key-value pair is associated with a category. Attributes: filepath (str): The path to the JSON file where the data is stored. data (dict): The dictionary that holds the data read from the JSON file. Methods: insert(category, key, value): Inserts a key-value pair into the database under the specified category. get(category, key): Retrieves the value associated with the specified key and category from the database. update(category, key): Update a value associated with the specified key and category from the database. delete(category, key): Deletes the key-value pair associated with the specified key and category from the database. _save(): Saves the current state of the database to the JSON file. """

def init(self, filepath):

#     self.filepath = filepath
#     try:
#         with open(filepath, 'r') as f:
#             self.data = json.load(f)
#             print(json.dumps(self.data, indent=4, ensure_ascii=False))
#     except FileNotFoundError:
#         self.data = {}
def __init__(self, filepath):
    self.filepath = filepath
    try:
        with open(filepath, 'r') as f:
            content = f.read().strip()
            if content:
                self.data = json.loads(content)
            else:
                self.data = {}
            print(json.dumps(self.data, indent=4, ensure_ascii=False))
    except FileNotFoundError:
        self.data = {}
    except json.JSONDecodeError as e:
        cstr(f"JSON error: {str(e)}").error.print()
        self.data = {}

— Reply to this email directly, view it on GitHub https://github.com/WASasquatch/was-node-suite-comfyui/issues/430#issuecomment-2403785218, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAIZEZPG3SKGQH5FZIERQFLZ2XP23AVCNFSM6AAAAABKLEGJQ6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDIMBTG44DKMRRHA . You are receiving this because you are subscribed to this thread.Message ID: @.***>