From 2462596232941849343d7ff1dd3b68c0efc7a652 Mon Sep 17 00:00:00 2001 From: JHCD Date: Sun, 31 May 2015 13:12:37 +0200 Subject: [PATCH] fix function freqToHz() for linux --- boswatch.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/boswatch.py b/boswatch.py index 33dbc65..da818fa 100755 --- a/boswatch.py +++ b/boswatch.py @@ -36,19 +36,25 @@ class MyTimedRotatingFileHandler(logging.handlers.TimedRotatingFileHandler): self.backupCount = backupCount -def freqToHz(freq) +## +# +# convert frequency to Hz +# +def freqToHz(freq): """ - gets a Frequenz and resolve it in Hz + gets a frequency and resolve it in Hz @type freq: string @param freq: frequency of the SDR Stick - @return: Frequenz in Hz + @return: frequency in Hz @exception: Exception if Error by recalc """ try: freq = freq.replace("k","e3").replace("M","e6") - return int(freq) + # freq has to be interpreted as float first... + # otherwise you will get the error: an invalid literal for int() with base 10 + return int(float(freq)) except: logging.exception("Error in freqToHz()")