Ankündigung

Einklappen
Keine Ankündigung bisher.

Fehler beim Booten vom SmartHome.py

Einklappen
X
 
  • Filter
  • Zeit
  • Anzeigen
Alles löschen
neue Beiträge

    Fehler beim Booten vom SmartHome.py

    Wenn ich meinen Server neu starte und dann smarthome.py automatisch gestartet wird, bekomme ich im log folgende meldung (und die Logic funktionieren nicht) :

    2014-02-24 15:18:58 ERROR Main Exception: 'ascii' codec can't decode byte 0xc3 in position 234: ordinal not in range(128)
    Traceback (most recent call last):
    File "/usr/local/smarthome/lib/logic.py", line 117, in generate_bytecode
    code = open(self.filename).read()
    File "/usr/lib/python3.2/encodings/ascii.py", line 26, in decode
    return codecs.ascii_decode(input, self.errors)[0]
    UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 234: ordinal not in range(128)
    2014-02-24 15:18:58 ERROR Main Exception: 'ascii' codec can't decode byte 0xc3 in position 414: ordinal not in range(128)
    Traceback (most recent call last):
    File "/usr/local/smarthome/lib/logic.py", line 117, in generate_bytecode
    code = open(self.filename).read()
    File "/usr/lib/python3.2/encodings/ascii.py", line 26, in decode
    return codecs.ascii_decode(input, self.errors)[0]
    UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 414: ordinal not in range(128)
    2014-02-24 15:18:58 ERROR Main Exception: 'ascii' codec can't decode byte 0xc3 in position 401: ordinal not in range(128)
    Traceback (most recent call last):
    File "/usr/local/smarthome/lib/logic.py", line 117, in generate_bytecode
    code = open(self.filename).read()
    File "/usr/lib/python3.2/encodings/ascii.py", line 26, in decode
    return codecs.ascii_decode(input, self.errors)[0]
    UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 401: ordinal not in range(128)
    2014-02-24 15:18:58 ERROR Main Exception: 'ascii' codec can't decode byte 0xc3 in position 124: ordinal not in range(128)
    Traceback (most recent call last):
    File "/usr/local/smarthome/lib/logic.py", line 117, in generate_bytecode
    code = open(self.filename).read()
    File "/usr/lib/python3.2/encodings/ascii.py", line 26, in decode
    return codecs.ascii_decode(input, self.errors)[0]
    UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 124: ordinal not in range(128)
    2014-02-24 15:18:58 ERROR Main Exception: 'ascii' codec can't decode byte 0xc3 in position 414: ordinal not in range(128)
    Traceback (most recent call last):
    File "/usr/local/smarthome/lib/logic.py", line 117, in generate_bytecode
    code = open(self.filename).read()
    File "/usr/lib/python3.2/encodings/ascii.py", line 26, in decode
    return codecs.ascii_decode(input, self.errors)[0]
    UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 414: ordinal not in range(128)
    2014-02-24 15:18:58 ERROR Main Exception: 'ascii' codec can't decode byte 0xc3 in position 186: ordinal not in range(128)
    Traceback (most recent call last):
    File "/usr/local/smarthome/lib/logic.py", line 117, in generate_bytecode
    code = open(self.filename).read()
    File "/usr/lib/python3.2/encodings/ascii.py", line 26, in decode
    return codecs.ascii_decode(input, self.errors)[0]
    UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 186: ordinal not in range(128)


    Wenn ich dann den Service Stoppe und wieder starte kommt die Fehlermeldung nicht. Es kommt nur beim neustart der Maschine.

    Was kann das sein? Danke für die Hilfe.

    Gruss Dany

    #2
    0xC3 ist kein ASCII Zeichen... warum das nur beim Neustart kommt? Gute Frage. Wie viele Logiken hast du denn? Kannst du es auf eine bestimmte eingrenzen und diese mal posten?
    Mit freundlichen Grüßen
    Niko Will

    Logiken und Schnittstelle zu anderen Systemen: smarthome.py - Visualisierung: smartVISU
    - Gira TS3 - iPhone & iPad - Mobotix T24 - ekey - Denon 2313 - Russound C5 (RIO over TCP Plugin) -

    Kommentar


      #3
      Fehler beim Booten vom SmartHome.py

      Ich habe in den Konfigurationsdateien der items deutsche Umlaute verwendet und musste in mein Ubuntu-Startskript (/etc/init/smarthome.conf) folgende Zeilen aufnehmen, damit ich nicht die gleiche Meldung bekomme:
      Code:
      ...
      env LANG=de_DE.utf8
      env LC_ALL=de_DE.utf8
      export LANG
      export LC_ALL
      ...
      Greetinx,
      Udo

      Kommentar


        #4
        Habe das Problem gefunden. Scheinbar verhält sich der start anders als beim restart.

        Beim Start darf im config file kein ö,ä,ü drin sein. Wenn ich diese alle remove dann bekomme ich keine fehler beim restart. Beim Restart hatte dies keinen Einfluss.

        Gruss Dany

        Kommentar


          #5
          Zitat von schlumdany15 Beitrag anzeigen
          Habe das Problem gefunden. Scheinbar verhält sich der start anders als beim restart.

          Beim Start darf im config file kein ö,ä,ü drin sein. Wenn ich diese alle remove dann bekomme ich keine fehler beim restart. Beim Restart hatte dies keinen Einfluss.
          Das liegt wahrscheinlich daran, dass der Systemstart mit einem anderen user (root) erfolgt als der restart (vermutlich Dein persönlicher user) und beide user unterschiedliche 'locale' Einstellungen verwenden. Das Setzen der beiden Umgebungsvariablen wie oben angegeben ermöglicht auch dem Startskript mit ä,ö,ü,ß in den config files zurechtzukommen.

          Greetinx,
          Udo

          Kommentar


            #6
            Hallo Udo

            Herzlichen Dank für die Info

            Cool Danke.

            Gruss Dany

            Kommentar


              #7
              Generell sollte man eher auf Umlaute und Sonderzeichen verzichten... spart eine Menge Kopfzerbrechen
              Mit freundlichen Grüßen
              Niko Will

              Logiken und Schnittstelle zu anderen Systemen: smarthome.py - Visualisierung: smartVISU
              - Gira TS3 - iPhone & iPad - Mobotix T24 - ekey - Denon 2313 - Russound C5 (RIO over TCP Plugin) -

              Kommentar


                #8
                Hi,

                Udo hat mit seiner Erklärung recht. Das Start-Skript im Pi-Image setzt ebenfalls die Umgebungsvariablen.

                Bis bald

                Marcus

                P.S Ich möchte nicht auf Umlaute verzichten, da ich diese in der Visu & Autogenerator verwenden möchte.

                Kommentar


                  #9
                  Ich habe das gleiche Problem unter Ubuntu 10.04. Es wurde ein Upgrade von smarthome 0.9 auf smarthome 1.0 durchgeführt. Meine knx.conf die vorher , also mit Python 2x funktioniert hat, funktioniert jetzt mit Python 3.2 nicht mehr.

                  Nach Start von Smarthome bekomme ich folgende Logfile-Ausgabe:
                  Code:
                  Init SmartHome.py 1.0
                  2014-05-15 22:25:20 ERROR    Main         Problem reading knx.conf: 'ascii' codec can't decode byte 0xc3 in position 811: ordinal not in range(128)
                  Traceback (most recent call last):
                    File "/usr/local/smarthome3/bin/smarthome3.py", line 291, in start
                      item_conf = lib.config.parse(self._items_dir + item_file, item_conf)
                    File "/usr/local/smarthome3/lib/config.py", line 46, in parse
                      for raw in f.readlines():
                    File "/usr/local/lib/python3.2/encodings/ascii.py", line 26, in decode
                      return codecs.ascii_decode(input, self.errors)[0]
                  UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 811: ordinal not in range(128)
                  Mein /etc/init.d/smarthome3.py sieht so aus, man beachte die hinzugefügten Umgebungsvariablen, die leider keinen Einfluss haben.

                  Code:
                  #!/bin/sh
                  ### BEGIN INIT INFO
                  # Provides:          smarthome
                  # Required-Start:    $syslog $network
                  # Required-Stop:     $syslog $network
                  # Should-Start:      eibd owserver
                  # Should-Stop:       eibd owserver
                  # Default-Start:     2 3 4 5
                  # Default-Stop:      0 1 6
                  # Short-Description: Start SmartHome.py
                  ### END INIT INFO
                  
                  DESC="SmartHome3.py"
                  NAME=smarthome3.py
                  SH_ARGS="-q"
                  SH_UID='smarthome'
                  
                  PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/local/bin
                  DIR=/usr/local/smarthome3/bin
                  DAEMON=$DIR/$NAME
                  SCRIPTNAME=/etc/init.d/$NAME
                  PIDFILE=/var/run/$NAME.pid
                  
                  [COLOR="Red"]env PYTHONIOENCODING=utf-8
                  env LANG=de_DE.utf8
                  env LC_ALL=de_DE.utf8
                  export PYTHONIOENCODING
                  export LANG
                  export LC_ALL
                  [/COLOR]
                  
                  [ -x "$DAEMON" ] || exit 0
                  [ -r /etc/default/$NAME ] && . /etc/default/$NAME
                  
                  DAEMON_ARGS="$SH_ARGS"
                  
                  do_start()
                  {
                      touch $PIDFILE
                      chown $SH_UID:$SH_UID $PIDFILE
                      start-stop-daemon --start --user $SH_UID --group $SH_UID --chuid $SH_UID --pidfile $PIDFILE --startas $DAEMON --test > /dev/null || return 1
                      start-stop-daemon --start --user $SH_UID --group $SH_UID --chuid $SH_UID --pidfile $PIDFILE --startas $DAEMON -- $DAEMON_ARGS || return 2
                      ps ax | grep $DAEMON | grep -v grep | awk '{print $1}' > $PIDFILE
                  }
                  
                  do_stop()
                  {
                      start-stop-daemon --stop --retry=TERM/30/KILL/5 --pidfile $PIDFILE
                      RETVAL="$?"
                      [ "$RETVAL" = 2 ] && return 2
                      start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --exec $DAEMON
                      [ "$?" = 2 ] && return 2
                      rm -f $PIDFILE 2> /dev/null
                      return "$RETVAL"
                  }
                  
                  do_reload() {
                      start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE --name $NAME
                      return 0
                  }
                  
                  case "$1" in
                      start)
                          do_start
                          ;;
                      stop)
                          do_stop
                          ;;
                      restart)
                          echo "Restarting $DESC" "$NAME"
                          do_stop
                          sleep 1
                          do_start
                          ;;
                      *)
                          echo "Usage: $SCRIPTNAME {start|stop|restart}" >&2
                          exit 3
                          ;;
                  
                  esac
                  
                  exit 0
                  Irgendwelche Ideen?


                  Grüße,
                  Michael
                  Viele Grüße,
                  Michael

                  Kommentar


                    #10
                    Hallo Michael,

                    ist die knx.conf vllt. nicht als utf-8 gespeichert?

                    Bis bald

                    Marcus

                    Kommentar


                      #11
                      Zitat von katmic Beitrag anzeigen
                      Mein /etc/init.d/smarthome3.py sieht so aus, man beachte die hinzugefügten Umgebungsvariablen, die leider keinen Einfluss haben.
                      Hallo Michael,

                      Du verwendest die "alte" Methode für das init-System und nicht wie ich upstart.
                      Der Befehl 'env' hat in einem (ba)sh-skript eine andere Bedeutung als in einem upstart-skript.
                      Daher musst Du in Deinem Startskript (ist ja ein shell-skript) die Variablen folgendermaßen setzen
                      Code:
                      export PYTHONIOENCODING=utf-8
                      export LANG=de_DE.utf8
                      export LC_ALL=de_DE.utf8
                      Wobei ich PYTHONIOENCODING nicht setze, sondern nur LANG und LC_ALL und es funktioniert auch.

                      Greetinx,
                      Udo

                      Kommentar


                        #12
                        Hallo umatz,

                        ja, das war es! Mit diesen Export-Einstellungen funktioniert es!


                        @Marcus: die Datei ist in UTF-8 gespeichert. Ich arbeite mit Notepad+ unter und greife per Samba-Share auf das Ubuntu-Verzeichnis zu.


                        Grüße,
                        Michael
                        Viele Grüße,
                        Michael

                        Kommentar


                          #13
                          Hallo,

                          ich habe dieses Problem auf meinem neuen System auch:
                          Code:
                          2016-02-18 22:08:45,200 INFO     Main         Start SmartHome.py 1.0-45-g02cf972+ -- smarthome.py:__init__:231
                          2016-02-18 22:08:45,201 DEBUG    Main         Python 3.4.3 -- smarthome.py:__init__:232
                          2016-02-18 22:08:45,201 INFO     Main         Init Scheduler -- scheduler.py:__init__:86
                          2016-02-18 22:08:45,202 DEBUG    Scheduler    creating 5 workers -- scheduler.py:run:93
                          2016-02-18 22:08:45,202 INFO     Main         Init Plugins -- smarthome.py:start:274
                          2016-02-18 22:08:45,208 DEBUG    Main         Plugin: knx -- plugin.py:__init__:43
                          2016-02-18 22:08:45,216 DEBUG    Main         KNX time next time: 2016-02-18 22:08:58+01:00 -- scheduler.py:_next_time:289
                          2016-02-18 22:08:45,216 DEBUG    Main         Plugin: cli -- plugin.py:__init__:43
                          2016-02-18 22:08:45,218 INFO     Main         Init Items -- smarthome.py:start:280
                          2016-02-18 22:08:45,234 ERROR    Main         Problem reading UVR.conf: 'ascii' codec can't decode byte 0xef in position 0: ordinal not in range(128) -- smarthome.py:start:293
                          Traceback (most recent call last):
                            File "/usr/local/smarthome/bin/smarthome.py", line 291, in start
                              item_conf = lib.config.parse(self._items_dir + item_file, item_conf)
                            File "/usr/local/smarthome/lib/config.py", line 46, in parse
                              for raw in f.readlines():
                          Ich starte smarthome.py mit diesem skript:
                          Code:
                          #!/bin/bash
                          export PYTHONIOENCODING=utf-8
                          export LANG=de_DE.utf8
                          export LC_ALL=de_DE.utf8
                          
                          /usr/local/smarthome/bin/smarthome.py -d
                          Sollte doch eigentlich so funktionieren, oder?

                          Gruß,
                          Hendrik

                          Kommentar


                            #14
                            Hi Hendrik,

                            sind die locals installiert? Ich meine manche (Minimal) Linux-Systeme habe nicht alles locals installiert.

                            Bis bald

                            Marcus

                            Kommentar


                              #15
                              Hi Hendrik,
                              ich glaube eher, das Du die UVR.conf mit BOM geschrieben hast.
                              Gruß,
                              Bernd

                              Kommentar

                              Lädt...
                              X