fix function freqToHz() for linux

This commit is contained in:
JHCD 2015-05-31 13:12:37 +02:00
parent 0a621b283a
commit 2462596232

View file

@ -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()")