Pequeño hack en gdesklets

Llevo bastante tiempo sin que me funcione gDesklets. Al intentar iniciarlo me aparecía el mensaje:

==========================================================[07/03/05-17:25:55]====== Error in the core! Please report this bug!

[EXC]exceptions.ValueError:
[EXC]too many values to unpack
in /usr/bin/gdesklets: line 14 ?
in /usr/lib/gdesklets/main/DisplayList.py: line 38 __init__
in /usr/lib/gdesklets/main/DisplayList.py: line 62 __load_list
[—]/usr/lib/gdesklets/main/DisplayList.py
[—] 57 self.__profiles[self.__current_profile] = []
[—] 58
[—] 59 for line in data:
[—] 60 if (not line):
[—] 61 continue
[ERR]> 62 ident, path, profile = line.split()
[—] 63 path = vfs.unescape_path(path)
[—] 64 profile = vfs.unescape_path(profile)
[—] 65 if (not profile in self.__profiles):
[—] 66 self.__profiles[profile] = []
[—] 67 self.__profiles[profile].append(ident)

Echando un vistazo a la línea que produce el problema se puede ver que al intentar obtener los valores de ident, path y profile encuentra más componentes a separar de los que espera. Lo primero que se me ocurrió es mostrar información de las líneas para ver qué estaba pasando:

for line in data:
  if (not line):
    continue
  print line
  ident, path, profile = line.split()
  […]

Con esto se puede ver las líneas de las que está intentando leer los valores que busca:

id11047078028230233 /usr/share/gdesklets/Displays/stickynotes/notes.display default

id1104707878405177 /home/nauj27/.gdesklets/Displays/LTDell/dell.display default

id11054844040964043 /home/nauj27/.gdesklets/Displays/muine_rhythm_desklet-1.7/muine_rhythm.display default

This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. /usr/share/gdesklets/Displays/others/debian-cow.display default

==========================================================[07/03/05-17:26:51]====== Error in the core! Please report this bug!
[…]

Hay alguna aplicación que lanza internamente gDesklets para ver la lista de componentes que tenemos cargados que en lugar de mostrar solo lo que se le pide muestra también una cabecera con la licencia. En la GPL«>GPL hay una parte que dice que si haces un programa para consola, las primeras líneas de la salida estándar del programa debe mostrar un mensaje informando de que es software libre e indicando que no se ofrece ninguna garantía (si es el caso):

TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
[…]
2.c If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.)

Habrá maneras seguramente más finas de hacerlo pero para salir del paso he añadido esto al archivo /usr/lib/gdesklets/main/DisplayList.py

for line in data:
  if (not line):
    continue
  if line[0:4] != «This»:
    ident, path, profile = line.split()
  […]

Y voilà:

nauj27@panoramix:~$ gdesklets
Iniciando el demonio gdesklets…
Se conectó con el demonio en 4679 milisegundos.

Escuchando: Moby – Raining again

Archivado en:Sin categoría

2 comentarios en “Pequeño hack en gdesklets”

  • DraXus dijo:

    Dónde se pueda hacer una chapucilla… xD

  • kaco dijo:

    Buenos Dias, te cuento que yo tengo problema con mi gdesklets corriendo sobre ubuntu, el problema especificamente es con el gadgets de «StickyNotes» cada vez que inicio me este me tira un error: