hhannine / superpaper

A cross-platform multi monitor wallpaper manager.
MIT License
1.12k stars 46 forks source link

PIL.UnidentifiedImageError: cannot identify image file #34

Closed kevinsmia1939 closed 4 years ago

kevinsmia1939 commented 4 years ago

Hello, I try to install superpaper on openSUSE Tumbleweed. I manage to start the application the first time, however after playing with the image source. It crash and I could not start it the second time, this is the error found.

kev@linux:~> superpaper
/usr/lib/python3.8/site-packages
/home/kev/.config/superpaper
/home/kev/.config/superpaper/profiles
Traceback (most recent call last):
  File "/usr/lib/python3.8/site-packages/superpaper/gui.py", line 916, in onSelect
    self.populate_fields(self.list_of_profiles[item])
  File "/usr/lib/python3.8/site-packages/superpaper/gui.py", line 524, in populate_fields
    profile.next_wallpaper_files(),
  File "/usr/lib/python3.8/site-packages/superpaper/data.py", line 471, in next_wallpaper_files
    return self.file_handler.next_wallpaper_files()
  File "/usr/lib/python3.8/site-packages/superpaper/data.py", line 526, in next_wallpaper_files
    next_image = iterable.__next__()
  File "/usr/lib/python3.8/site-packages/superpaper/data.py", line 557, in __next__
    image = self.files[self.counter]
IndexError: list index out of range
Killed
kev@linux:~> superpaper
/usr/lib/python3.8/site-packages
/home/kev/.config/superpaper
/home/kev/.config/superpaper/profiles
[xcb] Unknown sequence number while processing reply
[xcb] Most likely this is a multi-threaded client and XInitThreads has not been called
[xcb] Aborting, sorry about that.
python3: xcb_io.c:641: _XReply: Assertion `!xcb_xlib_threads_sequence_lost' failed.
Aborted (core dumped)
kev@linux:~> superpaper
/usr/lib/python3.8/site-packages
/home/kev/.config/superpaper
/home/kev/.config/superpaper/profiles
[xcb] Unknown request in queue while dequeuing
[xcb] Most likely this is a multi-threaded client and XInitThreads has not been called
[xcb] Aborting, sorry about that.
python3: xcb_io.c:163: dequeue_pending_request: Assertion `!xcb_xlib_unknown_req_in_deq' failed.
Gdk-Message: 23:34:37.376: superpaper: Fatal IO error 2 (No such file or directory) on X server :0.

kev@linux:~> superpaper
/usr/lib/python3.8/site-packages
/home/kev/.config/superpaper
/home/kev/.config/superpaper/profiles
[xcb] Unknown sequence number while processing reply
[xcb] Most likely this is a multi-threaded client and XInitThreads has not been called
[xcb] Aborting, sorry about that.
python3: xcb_io.c:641: _XReply: Assertion `!xcb_xlib_threads_sequence_lost' failed.
Aborted (core dumped)

Operating System: openSUSE Tumbleweed 20200414 KDE Plasma Version: 5.18.4 KDE Frameworks Version: 5.68.0 Qt Version: 5.14.1 Kernel Version: 5.6.2-1-default OS Type: 64-bit Processors: 8 × Intel® Core™ i7-3770 CPU @ 3.40GHz Memory: 7.5 GiB of RAM

kevinsmia1939 commented 4 years ago

I delete the .config/superpaper/ and it is able to start again. However, after adding image source and click apply this error occur with superpaper freeze and crash.

kev@linux:~> superpaper
/usr/lib/python3.8/site-packages
/home/kev/.config/superpaper
/home/kev/.config/superpaper/profiles
Exception in thread Thread-1:
Traceback (most recent call last):
  File "/usr/lib64/python3.8/threading.py", line 932, in _bootstrap_inner
    self.run()
  File "/usr/lib64/python3.8/threading.py", line 870, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/lib/python3.8/site-packages/superpaper/wallpaper_processing.py", line 1046, in span_single_image_simple
    file = profile.next_wallpaper_files()[0]
  File "/usr/lib/python3.8/site-packages/superpaper/data.py", line 471, in next_wallpaper_files
    return self.file_handler.next_wallpaper_files()
  File "/usr/lib/python3.8/site-packages/superpaper/data.py", line 526, in next_wallpaper_files
    next_image = iterable.__next__()
  File "/usr/lib/python3.8/site-packages/superpaper/data.py", line 557, in __next__
    image = self.files[self.counter]
IndexError: list index out of range

(superpaper:25502): Gtk-CRITICAL **: 23:39:59.965: gtk_tree_model_iter_nth_child: assertion 'n >= 0' failed
tmp.Save(): name is not set.

(superpaper:25502): Gtk-CRITICAL **: 23:40:06.884: gtk_tree_model_iter_nth_child: assertion 'n >= 0' failed
hhannine commented 4 years ago

Would you post the contents of the profile you're trying to apply and what prints you get when you run superpaper with the debug flag -d?

kevinsmia1939 commented 4 years ago
kev@linux:~> superpaper -d
/usr/lib/python3.8/site-packages
/home/kev/.config/superpaper
/home/kev/.config/superpaper/profiles
None
None
None
None
None
None
True
get_display_data output: NUM_DISPLAYS = 1, RES_ARR = [(1920, 1080)], OFF_ARR = [(0, 0)]
Display(resolution=(1920, 1080), digital_offset=(0, 0), phys_size_mm=(509, 286), detected_phys_size_mm=(509, 286), ppi=95.81139489194499, ppi_norm_resolution=None, ppi_norm_offset=None, ppi_norm_bezels=(0, 0), perspective_angles=(0, 0), name='VGA-1')
load_system: archive_file not found: /home/kev/.config/superpaper/display_systems.dat
START Listing profiles for menu.
hkBinding: ('control', 'super', 'shift', 'h')
Listed profile: example
hkBinding: ('control', 'super', 'shift', 'g')
Listed profile: example_multi
END Listing profiles for menu.
read profile name from 'running_profile': test
Exception: Previously run profile configuration                         file not found. Is the filename same as the                         profile name: test?
No previous profile was found.
hkBinding: ('control', 'super', 'shift', 'h')
Listed profile: example
hkBinding: ('control', 'super', 'shift', 'g')
Listed profile: example_multi
Registering binding:                                 ('control', 'super', 'shift', 'h') for profile: example
Registering binding:                                 ('control', 'super', 'shift', 'g') for profile: example_multi
use_hotkeys: True
hk_binding_next: ('control', 'super', 'w')
hk_binding_pause: ('control', 'super', 'shift', 'p')
get_display_data output: NUM_DISPLAYS = 1, RES_ARR = [(1920, 1080)], OFF_ARR = [(0, 0)]
Display(resolution=(1920, 1080), digital_offset=(0, 0), phys_size_mm=(509, 286), detected_phys_size_mm=(509, 286), ppi=95.81139489194499, ppi_norm_resolution=None, ppi_norm_offset=None, ppi_norm_bezels=(0, 0), perspective_angles=(0, 0), name='VGA-1')
load_system: archive_file not found: /home/kev/.config/superpaper/display_systems.dat
hkBinding: ('control', 'super', 'shift', 'h')
Listed profile: example
hkBinding: ('control', 'super', 'shift', 'g')
Listed profile: example_multi
use_hotkeys: True
hk_binding_next: ('control', 'super', 'w')
hk_binding_pause: ('control', 'super', 'shift', 'p')
use_hotkeys: True
hk_binding_next: ('control', 'super', 'w')
hk_binding_pause: ('control', 'super', 'shift', 'p')

(superpaper:18316): Gtk-CRITICAL **: 15:00:35.938: gtk_tree_model_iter_nth_child: assertion 'n >= 0' failed
test
single
False
None
None
None
None
['/home/kev/Desktop/Random']
hkBinding: ('control', 'super', 'shift', 'h')
Listed profile: example
hkBinding: ('control', 'super', 'shift', 'g')
Listed profile: example_multi
Listed profile: test
hkBinding: ('control', 'super', 'shift', 'h')
Listed profile: example
hkBinding: ('control', 'super', 'shift', 'g')
Listed profile: example_multi
Listed profile: test
Unreg hotkey ('control', 'super', 'w')
Unreg hotkey ('control', 'super', 'shift', 'p')
Unreg hotkey ('control', 'super', 'shift', 'g')
Unreg hotkey ('control', 'super', 'shift', 'h')
hkBinding: ('control', 'super', 'shift', 'h')
Listed profile: example
hkBinding: ('control', 'super', 'shift', 'g')
Listed profile: example_multi
Listed profile: test
Registering binding:                                 ('control', 'super', 'shift', 'h') for profile: example
Registering binding:                                 ('control', 'super', 'shift', 'g') for profile: example_multi
Registering binding:                                 None for profile: test

(superpaper:18316): Gtk-CRITICAL **: 15:00:39.809: gtk_tree_model_iter_nth_child: assertion 'n >= 0' failed
test
single
False
None
None
None
None
['/home/kev/Desktop/Random']
hkBinding: ('control', 'super', 'shift', 'h')
Listed profile: example
hkBinding: ('control', 'super', 'shift', 'g')
Listed profile: example_multi
Listed profile: test
hkBinding: ('control', 'super', 'shift', 'h')
Listed profile: example
hkBinding: ('control', 'super', 'shift', 'g')
Listed profile: example_multi
Listed profile: test
Unreg hotkey ('control', 'super', 'w')
Unreg hotkey ('control', 'super', 'shift', 'p')
Unreg hotkey ('control', 'super', 'shift', 'g')
Unreg hotkey ('control', 'super', 'shift', 'h')
hkBinding: ('control', 'super', 'shift', 'h')
Listed profile: example
hkBinding: ('control', 'super', 'shift', 'g')
Listed profile: example_multi
Listed profile: test
Registering binding:                                 ('control', 'super', 'shift', 'h') for profile: example
Registering binding:                                 ('control', 'super', 'shift', 'g') for profile: example_multi
Registering binding:                                 None for profile: test
onApply profile: saved /home/kev/.config/superpaper/profiles/test.profile
hkBinding: ('control', 'super', 'shift', 'h')
Listed profile: example
hkBinding: ('control', 'super', 'shift', 'g')
Listed profile: example_multi
Listed profile: test
Start profile: test
Running quick profile job with profile: test
quickswitch file lookup: ['test-a.png']
file:///home/kev/.cache/superpaper/temp/test-a.png
DESKTOP_SESSION is: '/usr/share/xsessions/kde-plasma'
Starting timed profile job with profile: test
Your DE could not be detected to set the wallpaper. You need to set the 'set_command' option in your settings file superpaper/general_settings. Exiting.
get_display_data output: NUM_DISPLAYS = 1, RES_ARR = [(1920, 1080)], OFF_ARR = [(0, 0)]
Display(resolution=(1920, 1080), digital_offset=(0, 0), phys_size_mm=(509, 286), detected_phys_size_mm=(509, 286), ppi=95.81139489194499, ppi_norm_resolution=None, ppi_norm_offset=None, ppi_norm_bezels=(0, 0), perspective_angles=(0, 0), name='VGA-1')
load_system: archive_file not found: /home/kev/.config/superpaper/display_systems.dat
running profile job with profile: test
Running a one-off wallpaper change.
/home/kev/Desktop/Random/38035.jpg
Wrote active profile: test
Canvas size: [1920, 1080]
file:///home/kev/.cache/superpaper/temp/test-b.png
DESKTOP_SESSION is: '/usr/share/xsessions/kde-plasma'
Your DE could not be detected to set the wallpaper. You need to set the 'set_command' option in your settings file superpaper/general_settings. Exiting.
kevinsmia1939 commented 4 years ago

I try adding this image as source and superpaper crash as well

Minty Decay (no LM 19)

hhannine commented 4 years ago

It's at least failing to detect KDE correctly. I'm planning to patch the KDE detection but in the meantime you can work around this by running superpaper with

DESKTOP_SESSION=plasma superpaper

Would you test if this alone resolves your issue? If not, post the debugging output again so I can take a look what else is going on.

kevinsmia1939 commented 4 years ago

The issue seems to dissappear now, but I got many warnings.

kev@linux:~> DESKTOP_SESSION=plasma superpaper
/usr/lib/python3.8/site-packages
/home/kev/.config/superpaper
/home/kev/.config/superpaper/profiles

(superpaper:21352): Gtk-CRITICAL **: 17:17:03.850: gtk_tree_model_iter_nth_child: assertion 'n >= 0' failed

(superpaper:21352): Gtk-CRITICAL **: 17:17:10.121: gtk_tree_model_iter_nth_child: assertion 'n >= 0' failed

(superpaper:21352): Gtk-CRITICAL **: 17:17:35.045: gtk_tree_model_iter_nth_child: assertion 'n >= 0' failed

(superpaper:21352): Gtk-CRITICAL **: 17:17:43.252: gtk_tree_model_iter_nth_child: assertion 'n >= 0' failed

(superpaper:21352): Gtk-CRITICAL **: 17:18:07.311: gtk_tree_model_iter_nth_child: assertion 'n >= 0' failed

(superpaper:21352): Gtk-CRITICAL **: 17:18:13.998: gtk_tree_model_iter_nth_child: assertion 'n >= 0' failed

(superpaper:21352): Gtk-CRITICAL **: 17:19:46.559: gtk_tree_model_iter_nth_child: assertion 'n >= 0' failed

(superpaper:21352): Gtk-CRITICAL **: 17:20:05.653: gtk_tree_model_iter_nth_child: assertion 'n >= 0' failed
kevinsmia1939 commented 4 years ago

However, trying to use the image I post above as source freeze superpaper. It show an error dialog "iCCP: CRC error"

kev@linux:~> DESKTOP_SESSION=plasma superpaper -d
/usr/lib/python3.8/site-packages
/home/kev/.config/superpaper
/home/kev/.config/superpaper/profiles
None
None
None
None
None
None
True
use_hotkeys: True
hk_binding_next: ('control', 'super', 'w')
hk_binding_pause: ('control', 'super', 'shift', 'p')
get_display_data output: NUM_DISPLAYS = 1, RES_ARR = [(1920, 1080)], OFF_ARR = [(0, 0)]
Display(resolution=(1920, 1080), digital_offset=(0, 0), phys_size_mm=(509, 286), detected_phys_size_mm=(509, 286), ppi=95.81139489194499, ppi_norm_resolution=None, ppi_norm_offset=None, ppi_norm_bezels=(0, 0), perspective_angles=(0, 0), name='VGA-1')
load_system: archive_file not found: /home/kev/.config/superpaper/display_systems.dat
START Listing profiles for menu.
hkBinding: ('control', 'super', 'shift', 'h')
Listed profile: example
hkBinding: ('control', 'super', 'shift', 'g')
Listed profile: example_multi
Listed profile: test
Listed profile: test3
Listed profile: tests3
Listed profile: yrs4
END Listing profiles for menu.
read profile name from 'running_profile': yrs4
get_display_data output: NUM_DISPLAYS = 1, RES_ARR = [(1920, 1080)], OFF_ARR = [(0, 0)]
Display(resolution=(1920, 1080), digital_offset=(0, 0), phys_size_mm=(509, 286), detected_phys_size_mm=(509, 286), ppi=95.81139489194499, ppi_norm_resolution=None, ppi_norm_offset=None, ppi_norm_bezels=(0, 0), perspective_angles=(0, 0), name='VGA-1')
load_system: archive_file not found: /home/kev/.config/superpaper/display_systems.dat
running profile job with profile: yrs4
Running wallpaper slideshow.
/home/kev/Desktop/Random/Hongkong protest/j67i27n7xv331.jpg
get_ppi_norm_offsets: [(0, 0)]
get_ppi_norm_crops: [(0, 0, 1920, 1080)]
G_A_DSYS.use_perspective: True, prof.perspective: default
Canvas size: [1920, 1080]
hkBinding: ('control', 'super', 'shift', 'h')
Listed profile: example
hkBinding: ('control', 'super', 'shift', 'g')
Listed profile: example_multi
Listed profile: test
Listed profile: test3
Listed profile: tests3
Listed profile: yrs4
Registering binding:                                 ('control', 'super', 'shift', 'h') for profile: example
Registering binding:                                 ('control', 'super', 'shift', 'g') for profile: example_multi
Registering binding:                                 None for profile: test
Registering binding:                                 None for profile: test3
Registering binding:                                 None for profile: tests3
Registering binding:                                 None for profile: yrs4
use_hotkeys: True
hk_binding_next: ('control', 'super', 'w')
hk_binding_pause: ('control', 'super', 'shift', 'p')
get_display_data output: NUM_DISPLAYS = 1, RES_ARR = [(1920, 1080)], OFF_ARR = [(0, 0)]
Display(resolution=(1920, 1080), digital_offset=(0, 0), phys_size_mm=(509, 286), detected_phys_size_mm=(509, 286), ppi=95.81139489194499, ppi_norm_resolution=None, ppi_norm_offset=None, ppi_norm_bezels=(0, 0), perspective_angles=(0, 0), name='VGA-1')
load_system: archive_file not found: /home/kev/.config/superpaper/display_systems.dat
hkBinding: ('control', 'super', 'shift', 'h')
Listed profile: example
hkBinding: ('control', 'super', 'shift', 'g')
Listed profile: example_multi
Listed profile: test
Listed profile: test3
Listed profile: tests3
Listed profile: yrs4
use_hotkeys: True
hk_binding_next: ('control', 'super', 'w')
hk_binding_pause: ('control', 'super', 'shift', 'p')
file:///home/kev/.cache/superpaper/temp/yrs4-b.png
DESKTOP_SESSION is: 'plasma'
Removing images matching with: 'yrs4-a-crop'
use_hotkeys: True
hk_binding_next: ('control', 'super', 'w')
hk_binding_pause: ('control', 'super', 'shift', 'p')
/home/kev/Desktop/Random/Hongkong protest/i6wdy203zx331.jpg
get_ppi_norm_offsets: [(0, 0)]
get_ppi_norm_crops: [(0, 0, 1920, 1080)]
G_A_DSYS.use_perspective: True, prof.perspective: default
Canvas size: [1920, 1080]
file:///home/kev/.cache/superpaper/temp/yrs4-a.png
DESKTOP_SESSION is: 'plasma'
Removing images matching with: 'yrs4-b-crop'

(superpaper:21792): Gtk-CRITICAL **: 17:26:48.260: gtk_tree_model_iter_nth_child: assertion 'n >= 0' failed
test4
single
False
None
None
None
None
['/home/kev/Desktop/Random/Minty Decay (no LM 19).png']
hkBinding: ('control', 'super', 'shift', 'h')
Listed profile: example
hkBinding: ('control', 'super', 'shift', 'g')
Listed profile: example_multi
Listed profile: test
Listed profile: test3
Listed profile: test4
Listed profile: tests3
Listed profile: yrs4
hkBinding: ('control', 'super', 'shift', 'h')
Listed profile: example
hkBinding: ('control', 'super', 'shift', 'g')
Listed profile: example_multi
Listed profile: test
Listed profile: test3
Listed profile: test4
Listed profile: tests3
Listed profile: yrs4
Unreg hotkey ('control', 'super', 'shift', 'p')
Unreg hotkey ('control', 'super', 'shift', 'g')
Unreg hotkey ('control', 'super', 'shift', 'h')
Unreg hotkey ('control', 'super', 'w')
hkBinding: ('control', 'super', 'shift', 'h')
Listed profile: example
hkBinding: ('control', 'super', 'shift', 'g')
Listed profile: example_multi
Listed profile: test
Listed profile: test3
Listed profile: test4
Listed profile: tests3
Listed profile: yrs4
Registering binding:                                 ('control', 'super', 'shift', 'h') for profile: example
Registering binding:                                 ('control', 'super', 'shift', 'g') for profile: example_multi
Registering binding:                                 None for profile: test
Registering binding:                                 None for profile: test3
Registering binding:                                 None for profile: test4
Registering binding:                                 None for profile: tests3
Registering binding:                                 None for profile: yrs4
Traceback (most recent call last):
  File "/usr/lib/python3.8/site-packages/superpaper/gui.py", line 923, in onApply
    saved_file = self.onSave(None)
  File "/usr/lib/python3.8/site-packages/superpaper/gui.py", line 1029, in onSave
    self.wpprev_pnl.preview_wallpaper(
  File "/usr/lib/python3.8/site-packages/superpaper/gui.py", line 1454, in preview_wallpaper
    bmp_clr, bmp_bw = self.resize_and_bitmap(img, canv_sz, True)
  File "/usr/lib/python3.8/site-packages/superpaper/gui.py", line 1470, in resize_and_bitmap
    pil = resize_to_fill(Image.open(fname), size, quality="fast")
  File "/usr/lib64/python3.8/site-packages/PIL/Image.py", line 2895, in open
    raise UnidentifiedImageError(
PIL.UnidentifiedImageError: cannot identify image file '/home/kev/Desktop/Random/Minty Decay (no LM 19).png'
hhannine commented 4 years ago

Wonderful. There are some benign GUI related warnings that I haven't gotten around to researching.

The new PIL error sound like the image could be problematic or corrupted somehow. Maybe try downloading it again?

hhannine commented 4 years ago

The problem with your specific image is out of my hands since it's the image library that raises the issue. I've not seen this error before. Though I should implement error handling for it.

kevinsmia1939 commented 4 years ago

I have never encounter this problem with this image before. I could open it in Gimp, LX image or Darktable. But there could be something with embedded color profile on the image. What library is use to open the image? I could ask the library dev to look into it.

hhannine commented 4 years ago

That's a good idea. I'm using the Pillow library. I found some matches with the error but nothing with a png.

hhannine commented 4 years ago

I try adding this image as source and superpaper crash as well

Minty Decay (no LM 19)

It could be that the image you shared has an invalid sRGB profile, that then is handled by some software and not others. You might be able to use this to fix it: https://stackoverflow.com/a/29337595

hhannine commented 4 years ago

I added some error catching so that superpaper wouldn't freeze or crash when running into a problematic image but unfortunately due to some second order issues I couldn't yet implement proper inform dialog for the user, this error only shows up in the debugging.

This is somewhat a low priority to improve further right now so I'll close this.