Contenu | Rechercher | Menus

Annonce

Si vous avez des soucis pour rester connecté, déconnectez-vous puis reconnectez-vous depuis ce lien en cochant la case
Me connecter automatiquement lors de mes prochaines visites.

À propos de l'équipe du forum.

#1 Le 02/03/2012, à 23:54

chachatte

Conky : Exception en point flottant [Resolu]

Bonsoir.
Voila j'ai trouve sur deviantart http://browse.deviantart.com/?qh=&secti … r#/d3fwysv un simple conky pour la meteo.
Mais voila je n'arrive pas a le faire fonctionner. J'ai suivi le readme, mais:

[chachatte@chacha ~]$ conky -c ~/.conky/Flat-Weather/conkyrc
Conky: desktop window (1600003) is subwindow of root window (ac)
Conky: window type - normal
Conky: drawing to created window (0x3c00001)
Conky: drawing to double buffer
/home/chachatte/.conky/Flat-Weather/weather.sh: ligne59: bc : commande introuvable
/home/chachatte/.conky/Flat-Weather/weather.sh: ligne61: bc : commande introuvable
--2012-03-02 22:52:13--  http://uk.weather.com/weather/today-FRXX0419
Resolving uk.weather.com... 96.8.85.140
Connecting to uk.weather.com|96.8.85.140|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/html]
Saving to: `/tmp/weather-FRXX0419'

    [  <=>                                                                                ] 86,497       173K/s   in 0.5s    

2012-03-02 22:52:14 (173 KB/s) - `/tmp/weather-FRXX0419' saved [86497]

Exception en point flottant

Si quelqu'un a une idee.
Ca changera de l'applet meteo de Xfce4 qui n'est pas tres saillant.
Merci d'avance

(edit modo : un titre clair ne coûte rien mais apporte beaucoup, merci d'y penser la prochaine fois)

Dernière modification par chachatte (Le 03/03/2012, à 15:15)

Hors ligne

#2 Le 03/03/2012, à 08:37

pingouinux

Re : Conky : Exception en point flottant [Resolu]

Bonjour,

chachatte #1 a écrit :

/home/chachatte/.conky/Flat-Weather/weather.sh: ligne59: bc : commande introuvable

N'est-ce pas tout simplement que la commande bc n'est pas installée ?

Hors ligne

#3 Le 03/03/2012, à 09:29

serged

Re : Conky : Exception en point flottant [Resolu]

[HS] Quel est l'ignare qui à traduit "floating point" en "point flottant" ?
La bonne traduction est "virgule flottante" !


LinuxMint Vera Cinnamon et d'autres machines en MATE, XFCE... 20.x , 21.x ou 19.x
Tour : Asus F2A55 / AMD A8-5600K APU 3,6GHz / RAM 16Go / Nvidia GeForce GT610 / LM21.1 Cinnamon
Portable : LDLC Mercure MH : Celeron N3450 /RAM 4Go / Intel HD graphics 500 i915 / biboot Win 10 (sur SSD) - LM21.1 MATE (sur HDD)

Hors ligne

#4 Le 03/03/2012, à 13:03

pourunmondesansgourou

Re : Conky : Exception en point flottant [Resolu]

@ serged :

Bah ! probablement quelqu'un qui fait un peu trop confiance à la traduction automatique, ou bien s'agit-il d'une erreur par étourderie ?

Le même genre d'étourderie qui permet d'écrire : « qui à traduit (...) » et excuse l'utilisation des guillemets anglais (" ") en langue française...

Sept erreurs en deux lignes : à quel niveau d'ignorance devrait-on t'estimer ?

Dernière modification par pourunmondesansgourou (Le 03/03/2012, à 13:14)


Environnement Enlightenment sur Ubuntu : https://github.com/batden

Hors ligne

#5 Le 03/03/2012, à 13:17

chachatte

Re : Conky : Exception en point flottant [Resolu]

Effectivement la commande BC n'etait pas installe, maintenant j'ai :

/home/chachatte/.conky/Flat-Weather/weather.sh: ligne 59 : printf: 32.00000000000000000000: nombre non valable
/home/chachatte/.conky/Flat-Weather/weather.sh: ligne 61 : printf: 9.00000000000000000000: nombre non valable

Hors ligne

#6 Le 03/03/2012, à 13:46

pingouinux

Re : Conky : Exception en point flottant [Resolu]

C'est sans doute un mauvais format dans le printf
Il faudrait voir ce que contient le fichier /home/chachatte/.conky/Flat-Weather/weather.sh

Hors ligne

#7 Le 03/03/2012, à 14:19

chachatte

Re : Conky : Exception en point flottant [Resolu]

Je poste le weather.sh:

#!/bin/bash

# Copyright (C) 2011 Pablo Zubieta. <http://pabloferz.deviantart.com/>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

while getopts :bBc:C:ef:i:l:p:s:S:tuwX:y:Y: OPT; do
case $OPT in
b) B=0;;
B) BB=0;;
c) COLOR=$OPTARG;;
C) HEX=$OPTARG;;
e) E=0;;
f) FONT=$OPTARG;;
i) LOCID=$OPTARG;;
l) LANG=$OPTARG;;
p) CITY=$OPTARG;;
s) SIZE=$OPTARG;;
S) ISIZE=$OPTARG;;
t) TS=0;;
u) U=0;;
w) W=0;;
X) IX=$OPTARG;;
y) Y=$OPTARG;;
Y) IY=$OPTARG;;
esac
done

if [ -z "$CITY" ]; then
   echo 'A city name must be supplied (weather.sh -p "City Name").'
elif [ -z "$LOCID" ]; then
   echo 'A location ID must be supplied (weather.sh -i "LocID"). Find yours at http://aspnetresources.com/tools/weatherIdResolver'
else

   if [[ ! "$SIZE" =~ ^[0-9]+$ ]]; then SIZE=12; fi
   BFSIZE=":size=$SIZE"
   if [ "$B" = "0" ]; then BBOLD=":Bold"; fi
   if [ "$BB" = "0" ]; then BBOLD=":Bold"; BOLD=":Bold"; fi
   if [ $(ping -c2 facebook.com | grep "2 received" | wc -l) -ne 1 ]; then
      echo "\${font $FONT$BBOLD$BFSIZE}$CITY"
      echo "\${voffset -5}"
   else

      if [[ "$Y" =~ ^-?[0-9]+$ ]]; then YSPACE="\${voffset $Y}"; fi
      if [[ ! "$IY" =~ ^-?[0-9]+$ ]]; then IY=0; fi
      if [[ ! "$IX" =~ ^-?[0-9]+$ ]]; then IX=0; fi
      if [[ ! "$ISIZE" =~ ^[0-9]+$ ]]; then 
         ISIZE=$(printf %.0f $(echo "$SIZE*8/3" | bc -l))
      fi
      SFSIZE=":size=$(printf %.0f $(echo "$SIZE*3/4" | bc -l))"
      TSIZE=$(($ISIZE+14))
      RESIZE="-resize ${ISIZE}x${ISIZE} "

      if [ "$COLOR" ]; then COLOR="-fill $COLOR -colorize 100% "
      elif [ "$HEX" ]; then COLOR="-fill #$HEX -colorize 100% "
      fi

      COLON=": "
      if [ "$LANG" = "es" ]; then LANG="espanol"; NOWIND="En calma"
      elif [ "$LANG" = "fr" ]; then COLON=" : "; NOWIND="Faible"
      else LANG="uk"; NOWIND="Calm"
      fi

      if [ "$E" = "0" ]; then UNIT=" °F"; WUNIT=" mph"; TU="e"
      else UNIT=" °C"; WUNIT=" km/h"; TU="m"
      fi

      FILE="/tmp/weather-$LOCID"
      cd ~/.conky/Flat-Weather
      wget -O $FILE --load-cookies=$TU.txt "http://$LANG.weather.com/weather/today-$LOCID"
      sed -i 's/^[ \t\r]*//;s/\r$//;/^$/ d' $FILE

      echo '${font '$FONT$BBOLD$BFSIZE'}${goto '$TSIZE'}'$CITY', '$(cat $FILE | grep "x_t" | sed 's/&.*//;s/.*>//')$UNIT'${font '$FONT$SFSIZE'}${color1}'
      if [ "$TS" = "0" ]; then
         echo $YSPACE'${goto '$TSIZE'}'$(cat $FILE | grep "#66" | sed 's/.*>//')$COLON$(cat $FILE | grep -A 1 "#66" | sed '/#/d;s/&.*//')$UNIT
      fi
      if [ "$W" = "0" ]; then
         WIND=$(cat $FILE | grep -A 3 "rent_r" | sed '/[0-9]/!d;s/ .*//')
         echo $YSPACE'${goto '$TSIZE'}'$(cat $FILE | grep -A 1 "rent_r" | sed '/<d/d;s/<\/.*//;s/.*>//')$COLON$(if [ "$WIND" ]; then echo $WIND$WUNIT; else echo $NOWIND; fi)
      fi
      if [ "$U" = "0" ]; then
         echo $YSPACE'${goto '$TSIZE'}'$(cat $FILE | grep "UV" | sed 's/<\/.*//;s/.*>//')$COLON$(cat $FILE | grep "UV" | sed 's/ (.*//;s/.*>//;s/ / - /')
      fi
      echo $YSPACE'${font '$FONT$BOLD$SFSIZE'}${goto '$TSIZE'}${color1}'$(cat $FILE | grep -A 1 ":ce" | sed '/<d/d;s/<b>//;s/<.*//')
      convert ~/.conky/Flat-Weather/Flat/$(cat $FILE | grep "x_ic" | sed 's/.*3\///;s/[.].*//').png $RESIZE$COLOR/tmp/weather-icon2.png
      echo '${image /tmp/weather-icon2.png -p '$IX','$IY'}'
   fi

fi

Hors ligne

#8 Le 03/03/2012, à 14:37

pingouinux

Re : Conky : Exception en point flottant [Resolu]

Le message d'erreur en #5 est en français; il se peut que printf attende un nombre avec une virgule, et non un point.
Dans ce cas, il faudrait remplacer les lignes 59 et 61 par :
Ligne 59

         ISIZE=$(printf %.0f $(echo "$SIZE*8/3" | bc -l | sed 's/\./,/'))

Ligne 61

      SFSIZE=":size=$(printf %.0f $(echo "$SIZE*3/4" | bc -l | sed 's/\./,/'))"

Hors ligne

#9 Le 03/03/2012, à 15:14

chachatte

Re : Conky : Exception en point flottant [Resolu]

Merci beaucoup ca fonctionne smile Plus qu'a trouver comment le mettre en francais.

Hors ligne

#10 Le 03/03/2012, à 18:54

chachatte

Re : Conky : Exception en point flottant [Resolu]

Reussi a le mettre en francais mais une fois sur trois ou quatre

--2012-03-03 17:53:26--  http://fr.weather.com/weather/today-FRXX0008
Resolving fr.weather.com... failed: Name or service not known.
wget: unable to resolve host address `fr.weather.com'

Hors ligne

#11 Le 04/03/2012, à 09:34

serged

Re : Conky : Exception en point flottant [Resolu]

pourunmondesansgourou a écrit :

@ serged :

Bah ! probablement quelqu'un qui fait un peu trop confiance à la traduction automatique, ou bien s'agit-il d'une erreur par étourderie ?

Le même genre d'étourderie qui permet d'écrire : « qui à traduit (...) » et excuse l'utilisation des guillemets anglais (" ") en langue française...

Sept erreurs en deux lignes : à quel niveau d'ignorance devrait-on t'estimer ?

Le "à" est une erreur d'étourderie (qui aurait été probablement corrigée à la relecture si le texte avait été destiné à l'éternité). Quant aux guillemets "anglais" (qui ne sont pas des guillemets anglais mais des guillemets droits), ils sont dus à la conception des claviers d'ordinateur qui n'ont pas de « » facilement accessibles (et sont corrigés automatiquement dans les traitements de texte dignes de ce nom).


LinuxMint Vera Cinnamon et d'autres machines en MATE, XFCE... 20.x , 21.x ou 19.x
Tour : Asus F2A55 / AMD A8-5600K APU 3,6GHz / RAM 16Go / Nvidia GeForce GT610 / LM21.1 Cinnamon
Portable : LDLC Mercure MH : Celeron N3450 /RAM 4Go / Intel HD graphics 500 i915 / biboot Win 10 (sur SSD) - LM21.1 MATE (sur HDD)

Hors ligne