Ankündigung

Einklappen
Keine Ankündigung bisher.

Bytecode . sheduler.py system.py

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

    Bytecode . sheduler.py system.py

    Hallo,
    ich verzweifle an dem dargestellten Fehlertext. Der Fehler taucht alle 5 Minuten auf. Ich habe keine Ahnung wo ich ansetzen soll.

    Wer kann mir bitte auf die Sprünge helfen?

    Weitere Informationen liefere ich gerne, sobald mir ein Ansatz erkennbar wird.

    Danke für jeden Hinweis!

    Wolfgang

    Code:
    2015-06-27 02:07:23 INFO     System       Threads (7): env_stat: 1, Main: 1, 1w-sen: 1, Scheduler: 1, System: 1, idle: 2
    2015-06-27 02:07:23 ERROR    System       Logic: System, File: /usr/local/smarthome/logics/system.py, Line: 33, Method: <module>, Exception: unorderable types: type() < ABCMeta()
    Traceback (most recent call last):
      File "/usr/local/smarthome/lib/scheduler.py", line 327, in _task
        exec(obj.bytecode)
      File "/usr/local/smarthome/logics/system.py", line 33, in <module>
        pairs = sorted([(x[1],x[0]) for x in list(d.items())])
    TypeError: unorderable types: type() < ABCMeta()
    2015-06-27 02:12:23 INFO     System       Threads (7): env_stat: 1, Main: 1, 1w-sen: 1, Scheduler: 1, System: 1, idle: 2
    2015-06-27 02:12:23 ERROR    System       Logic: System, File: /usr/local/smarthome/logics/system.py, Line: 33, Method: <module>, Exception: unorderable types: type() < ABCMeta()
    Traceback (most recent call last):
      File "/usr/local/smarthome/lib/scheduler.py", line 327, in _task
        exec(obj.bytecode)
      File "/usr/local/smarthome/logics/system.py", line 33, in <module>
        pairs = sorted([(x[1],x[0]) for x in list(d.items())])
    TypeError: unorderable types: type() < ABCMeta()
    2015-06-27 02:17:23 INFO     System       Threads (7): env_stat: 1, Main: 1, 1w-sen: 1, Scheduler: 1, System: 1, idle: 2
    2015-06-27 02:17:23 ERROR    System       Logic: System, File: /usr/local/smarthome/logics/system.py, Line: 33, Method: <module>, Exception: unorderable types: type() < ABCMeta()
    Traceback (most recent call last):
      File "/usr/local/smarthome/lib/scheduler.py", line 327, in _task
        exec(obj.bytecode)
      File "/usr/local/smarthome/logics/system.py", line 33, in <module>
        pairs = sorted([(x[1],x[0]) for x in list(d.items())])
    TypeError: unorderable types: type() < ABCMeta()

    #2
    Naja,

    Du hast eine Logik system.py geschrieben und die hat Fehler. Die Logik rufst Du alle 5 Minuten auf und deswegen kommt alle 5 Minuten der Fehler.
    Da würde ich ansetzen.

    Gruß, Waldemar
    OpenKNX www.openknx.de

    Kommentar


      #3
      Halo Waldemar,
      entschuldige die späte Antwort. Erst einmal mein Dank für Deine Mühe.

      Ich habe keine eigene Logik erstellt!
      Eingebunden habe ich jedoch die smarthome.py-Seite aus den Beispielen. Diese wird wohl alle 5 Minuten aktuallisiert.

      Der Fehler steckt in der Zeile 32

      Code:
      # Object Counter
      d = {}
      sys.modules
      # collect all classes
      for m in list(sys.modules.values()):
          for sym in dir(m):
              o = getattr (m, sym)
              if isinstance(o, type):
                  d[o] = sys.getrefcount (o)                                                Das ist Zeile 32
      # sort by refcount
      pairs = sorted([(x[1],x[0]) for x in list(d.items())])
      pairs.reverse()
      obj = ''
      for n, c in pairs[:10]:
          obj += "{0}: {1}, ".format(c.__name__, n)
      obj = obj.strip(', ')
      logger.info("Objects (Top 10): {0}".format(obj))
      Hier die komplette Datei!
      Habe ich irgendwo ein Update übersehen oder einen Tippfehler eingefangen?

      Ich hoffe noch auf einen Hinweis aus der großen Gemeinde!

      Wolfgang

      Code:
      #cat logics/system.py
      
      def td2str(td):
          hours, seconds = divmod(td.seconds, 3600)
          minutes, seconds = divmod(td.seconds, 60)
          if td.days:
              return "{0}d {1}h {2}m".format(td.days, hours, minutes)
          else:
              return "{0}h {1}m".format(hours, minutes)
      
      # Runtime
      runtime = sh.tools.runtime()
      #sh.smarthome.runtime(td2str(runtime))
      #sh.system.runtime(td2str(runtime))
      
      # Threads
      tn = {}
      tc = threading.activeCount()
      for t in threading.enumerate():
          tn[t.name] = tn.get(t.name, 0) + 1
      logger.info('Threads ({0}): '.format(tc) + ', '.join("{0}: {1}".format(k, v) for (k, v) in list(tn.items())))
      #sh.smarthome.threads(tc)
      
      # Object Counter
      d = {}
      sys.modules
      # collect all classes
      for m in list(sys.modules.values()):
          for sym in dir(m):
              o = getattr (m, sym)
              if isinstance(o, type):
                  d[o] = sys.getrefcount (o)
      # sort by refcount
      pairs = sorted([(x[1],x[0]) for x in list(d.items())])
      pairs.reverse()
      obj = ''
      for n, c in pairs[:10]:
          obj += "{0}: {1}, ".format(c.__name__, n)
      obj = obj.strip(', ')
      logger.info("Objects (Top 10): {0}".format(obj))
      
      # Garbage
      import gc
      gc.set_debug(gc.DEBUG_LEAK)
      gc.collect()
      if gc.garbage != []:
          logger.warning("Garbage: {0}".format(gc.garbage))
          del gc.garbage[:]
      
      # Load
      l1, l5, l15 = os.getloadavg()
      logger.debug("Load: {0}, {1}, {2}".format(l1, l5, l15))
      sh.system.load(round(l5, 2))
      
      # Memory
      statusfile = "/proc/{0}/status".format(os.getpid())
      units = {'kB': 1024, 'mB': 1048576}
      with open(statusfile, 'r') as f:
          data = f.read()
      status = {}
      for line in data.splitlines():
          key, sep, value = line.partition(':')
          status[key] = value.strip()
      size, unit = status['VmRSS'].split(' ')
      mem = int(size) * units[unit]
      sh.smarthome.memory(mem)
      
      # System Memory
      statusfile = "/proc/meminfo"
      units = {'kB': 1024, 'mB': 1048576}
      with open(statusfile, 'r') as f:
          data = f.read()
      for line in data.splitlines():
          key, sep, value = line.partition(':')
          if key.startswith('Mem'):
              size, unit = value.strip().split(' ')
              mem = int(size) * units[unit]
              if key == 'MemTotal':
                  total = mem
              elif key == 'MemFree':
                  free = mem
      sh.system.memory(100-int(free/(total/100)))
      
      # System Uptime
      statusfile = "/proc/uptime"
      with open(statusfile, 'r') as f:
          data = f.read()
      uptime = int(float(data.split()[0]))
      uptime = datetime.timedelta(seconds=uptime)
      sh.system.uptime(td2str(uptime))

      Kommentar


        #4
        Hi,

        ich kann Dir leider nicht helfen, ich kann kein python und habe auch keine Ahnung, was da passiert bzw. was das macht.
        Ich kann Dir nur empfehlen, nicht mit so komplexen Logiken anzufangen, wenn man sich nicht auskennt...

        Da muss wohl jemand anders dran.

        Gruß, Waldemar
        OpenKNX www.openknx.de

        Kommentar


          #5
          Hallo,

          wie bereits gesagt. Lösche die Logik.

          Bis bald

          Marcus

          Kommentar

          Lädt...
          X