Ankündigung

Einklappen
Keine Ankündigung bisher.

Python invalid literal for float()

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

    HS/FS Python invalid literal for float()

    I made a module which converts the temperatures sent by a Mobotix camera (strings) into a Float.
    Some examples of the format of the temperature sent by Mobotix:
    +11.4
    + 9.2 (with a space between the + en the 9)
    - 8.3 (with a space between the - en the 8)
    -11.5

    The logic formula looks like this:
    5012|0|"EN[1][:1]=='+'"|"float(EN[1][-4:])" |""|1|0|0|0
    5012|0|"EN[1][:1]<>'+'"|"0-float(EN[1][-4:])"|""|1|0|0|0

    For some reason this seems to work but creates Exceptions in the HS3 debug file:
    File "./../hssrc/hs_logik.py", line 232, in calc
    File "formula", line 1, in [module]
    ValueError: invalid literal for float(): ----
    [5012L, 10032L, 0L, "EN[1][:1][]'+'", '0-float(EN[1][-4:])', '', 1L, 0L, 0L, 0L]

    Any idea why?
Lädt...
X