{"id":165,"date":"2005-07-03T15:31:19","date_gmt":"2005-07-03T13:31:19","guid":{"rendered":""},"modified":"2005-07-03T15:31:19","modified_gmt":"2005-07-03T13:31:19","slug":"pequea%c2%b1o-hack-en-gdesklets","status":"publish","type":"post","link":"https:\/\/nauj27.com\/blog\/?p=165","title":{"rendered":"Peque\u00f1o hack en gdesklets"},"content":{"rendered":"<p>Llevo <a href=\"http:\/\/nauj27.com\/comments.php?id=P76_0_1_0_C\" title=\"bastante tiempo\">bastante tiempo<\/a> sin que me funcione <a href=\"http:\/\/gdesklets.gnomedesktop.org\/index.php\" title=\"gDesklets\">gDesklets<\/a>. Al intentar iniciarlo me aparec\u00eda el mensaje:<\/p>\n<p class=\"cita\">==========================================================[07\/03\/05-17:25:55]====== Error in the core! Please report this bug!<\/p>\n<p>[EXC]exceptions.ValueError:<br \/>\n[EXC]<b>too many values to unpack<\/b><br \/>\nin \/usr\/bin\/gdesklets: line 14 ?<br \/>\nin \/usr\/lib\/gdesklets\/main\/DisplayList.py: line 38 __init__<br \/>\nin \/usr\/lib\/gdesklets\/main\/DisplayList.py: line 62 __load_list<br \/>\n[&#8212;]\/usr\/lib\/gdesklets\/main\/DisplayList.py<br \/>\n[&#8212;]   57         self.__profiles[self.__current_profile] = []<br \/>\n[&#8212;]   58<br \/>\n[&#8212;]   59         for line in data:<br \/>\n[&#8212;]   60             if (not line):<br \/>\n[&#8212;]   61                 continue<br \/>\n[ERR]>  62             <b>ident, path, profile = line.split()<\/b><br \/>\n[&#8212;]   63             path = vfs.unescape_path(path)<br \/>\n[&#8212;]   64             profile = vfs.unescape_path(profile)<br \/>\n[&#8212;]   65             if (not profile in self.__profiles):<br \/>\n[&#8212;]   66                 self.__profiles[profile] = []<br \/>\n[&#8212;]   67             self.__profiles[profile].append(ident)<\/p>\n<p>Echando un vistazo a la l\u00ednea que produce el problema se puede ver que al intentar obtener los valores de <b>ident<\/b>, <b>path<\/b> y <b>profile<\/b> encuentra m\u00e1s componentes a separar de los que espera. Lo primero que se me ocurri\u00f3 es mostrar informaci\u00f3n de las l\u00edneas para ver qu\u00e9 estaba pasando:<\/b><\/p>\n<p class=\"cita\">for line in data:<br \/>\n&nbsp;&nbsp;if (not line):<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;continue<br \/>\n&nbsp;&nbsp;<span style=\"color:red\">print line<\/span><br \/>\n&nbsp;&nbsp;ident, path, profile = line.split()<br \/>\n&nbsp;&nbsp;[&#8230;]<\/p>\n<p>Con esto se puede ver las l\u00edneas de las que est\u00e1 intentando leer los valores que busca:<\/p>\n<p class=\"cita\">id11047078028230233 \/usr\/share\/gdesklets\/Displays\/stickynotes\/notes.display default<\/p>\n<p>id1104707878405177 \/home\/nauj27\/.gdesklets\/Displays\/LTDell\/dell.display default<\/p>\n<p>id11054844040964043 \/home\/nauj27\/.gdesklets\/Displays\/muine_rhythm_desklet-1.7\/muine_rhythm.display default<\/p>\n<p><b>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<\/b><\/p>\n<p>==========================================================[07\/03\/05-17:26:51]====== Error in the core! Please report this bug!<br \/>\n[&#8230;]<\/p>\n<p>Hay alguna aplicaci\u00f3n que lanza internamente <b>gDesklets<\/b> para ver la lista de componentes que tenemos cargados que en lugar de mostrar solo lo que se le pide muestra tambi\u00e9n una cabecera con la licencia. En la <a href=\"http:\/\/www.gnu.org\/licenses\/gpl.html\" title=\"<acronym title=\"General Public License\">GPL<\/acronym>\u00ab><acronym title=\"General Public License\">GPL<\/acronym><\/a> hay una parte que dice que si haces un programa para consola, las primeras l\u00edneas de la salida est\u00e1ndar del programa debe mostrar un mensaje informando de que es software libre e indicando que no se ofrece ninguna garant\u00eda (si es el caso):<\/p>\n<p class=\"cita\">TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION<br \/>\n[&#8230;]<br \/>\n2.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.)<\/p>\n<p>Habr\u00e1 maneras seguramente m\u00e1s finas de hacerlo pero para salir del paso he a\u00f1adido esto al archivo <b>\/usr\/lib\/gdesklets\/main\/DisplayList.py<\/b><\/p>\n<p class=\"cita\">for line in data:<br \/>\n&nbsp;&nbsp;if (not line):<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;continue<br \/>\n&nbsp;&nbsp;<span style=\"color:red\">if line[0:4] != \u00abThis\u00bb:<\/span><br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;ident, path, profile = line.split()<br \/>\n&nbsp;&nbsp;[&#8230;]<\/p>\n<p>Y voil\u00c3\u00a0:<\/p>\n<p class=\"cita\">nauj27@panoramix:~$ gdesklets<br \/>\nIniciando el demonio gdesklets&#8230;<br \/>\nSe conect\u00f3 con el demonio en 4679 milisegundos.<\/p>\n<p class=\"escuchando\">Escuchando: Moby &#8211; Raining again<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Llevo bastante tiempo sin que me funcione gDesklets. Al intentar iniciarlo me aparec\u00eda 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 [&#8212;]\/usr\/lib\/gdesklets\/main\/DisplayList.py [&#8212;] 57 self.__profiles[self.__current_profile] = [] [&#8212;] 58 [&#8212;] 59 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[],"tags":[],"_links":{"self":[{"href":"https:\/\/nauj27.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/165"}],"collection":[{"href":"https:\/\/nauj27.com\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/nauj27.com\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/nauj27.com\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/nauj27.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=165"}],"version-history":[{"count":0,"href":"https:\/\/nauj27.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/165\/revisions"}],"wp:attachment":[{"href":"https:\/\/nauj27.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=165"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/nauj27.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=165"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/nauj27.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=165"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}