theUpsider / ComfyUI-Styles_CSV_Loader

This extension allows users to load styles from a CSV file, primarily for migration purposes from the [automatic1111 Stable Diffusion web UI](https://github.com/AUTOMATIC1111/stable-diffusion-webui).
MIT License
34 stars 4 forks source link

Error: list index out of range #1

Closed bramvera closed 2 months ago

bramvera commented 1 year ago

got error

styles_csv_loader.py", line 42, in INPUT_TYPES
    "styles": (list(cls.styles_csv.keys()),),
AttributeError: 'list' object has no attribute 'keys'
Error: list index out of range
theUpsider commented 1 year ago

You have to name the file: styles.csv also check if the format in the file is correct. If you manually saved the file in excel it likely got corrupted.

bramvera commented 1 year ago

the same file I'm using with A1111, working fine on A1111

image

bramvera commented 1 year ago

i replaced line 42 with this "styles": (list(style[0] for style in cls.styles_csv),), and fixed my error

update: node and styles are loaded but break some function

theUpsider commented 12 months ago

Thanks for the proposal. Will look into this as soon as I can.

theUpsider commented 11 months ago

@brumie I worked in your fix. Please report if it works :)

bramvera commented 11 months ago

@brumie I worked in your fix. Please report if it works :)

thanks, got an error

Error occurred when executing Load Styles CSV:

list indices must be integers or slices, not str
cjps-br commented 11 months ago

the same error was occurring in my installation. I then noticed that the style names were not in quotes. I adjusted the .csv file to put quotes around all the style names, but I had to return line 42 to the previous version

("styles": (list(cls.styles_csv.keys()),),)

for everything to work.

MarcelMoczarski commented 10 months ago

thanks for the extension.

in "styles": (list(style[0] for style in cls.styles_csv),)" should indeed be "("styles": (list(cls.styles_csv.keys()),)," as mentioned above, otherwise style[0] returns the first letter of each dict key instead of the complete variable name.

theUpsider commented 10 months ago

I reverted the change. @brumie probably had a corrupt styles csv. Please report further issues! Thanks all for your participation