s-ol / themer

Themer is a colorscheme generator and manager for your desktop.
Other
300 stars 40 forks source link

"too many values to unpack" in KmeansColorParser #7

Closed cheripai closed 9 years ago

cheripai commented 9 years ago
Traceback (most recent call last):
  File "/usr/bin/themer", line 284, in <module>
    generate(color_file, config, template_dir, theme_name)
  File "/usr/bin/themer", line 136, in generate
    colors = parse.read()
  File "/usr/lib/python3.4/site-packages/Themer-1.0-py3.4.egg/themer/parsers/__init__.py", line 158, in read
  File "/usr/lib/python3.4/site-packages/Themer-1.0-py3.4.egg/themer/parsers/__init__.py", line 141, in get_dominant_colors
  File "/usr/lib/python3.4/site-packages/kmeans/__init__.py", line 103, in kmeans
    tolerance=tolerance, max_iterations=max_iterations)
  File "/usr/lib/python3.4/site-packages/kmeans/__init__.py", line 60, in _kmeans
    (r, g, b), count = center
ValueError: too many values to unpack (expected 3)
cheripai commented 9 years ago

Also, the link in the README to config/default is broken

s-ol commented 9 years ago

I had this happen before with some specific wallpapers. It seems to be a bug within the kmeans implementation or their output.

Did you try other wallpapers yet? I'll have to investigate some of those specific wallpapers...

s-ol commented 9 years ago

Wait, judging by your stack trace this is actually a problem with the kmeans PyPi package. Could you try removing it and running the wallpaper through the slower python implementation?

cheripai commented 9 years ago

That seems to have fixed it, but themer fails on larger images. I think I may have found the problem, so I sent a pull request.

s-ol commented 9 years ago

What exactly fixed it? The type-bug in wallfix can only come into effect after the image generation and I am not sure how the logger.debug lines are supposed to break anything... though those logger.debug calls really don't show up in the debug output.

Could you put the changes into a single patch branch and submit a PR against the develop branch? Also please delete the lines instead of commenting them out.

cheripai commented 9 years ago

Sure, no problem.

When I ran themer on large images, I would get an error NameError: name 'random' is not defined This did not occur on smaller images for some reason. So I just imported random to themer/parsers/__init__.py. Afterwards, I needed to import debug, but the package on PyPI was broken (because of a deprecated call to __builtin__). That is why I commented them out, but I will remove them now.

After these changes, themer seems to be running fine for me.