Skip to content

Commit

Permalink
modify linux_command exception-handling (#682)
Browse files Browse the repository at this point in the history
Former-commit-id: 2340fef
  • Loading branch information
kizniche committed Aug 30, 2019
1 parent 92e49c8 commit 74211b3
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ This release changes how user-created Python code is executed. This affects Pyth
- Refactor RPC by replacing RPyC with Pyro4 for improved system stability ([#671](https://github.com/kizniche/mycodo/issues/671), [#679](https://github.com/kizniche/mycodo/issues/679))
- Increase Nginx file upload size
- Reorganize menu layout
- Modify linux_command exception-handling ([#682](https://github.com/kizniche/mycodo/issues/682))


## 7.6.3 (2019-07-14)
Expand Down
2 changes: 1 addition & 1 deletion mycodo/inputs/linux_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ def get_measurement(self):
if str_is_float(out):
measurement_value = float(out)
else:
self.logger.error(
self.logger.debug(
"The command returned a non-numerical value. "
"Ensure only one numerical value is returned "
"by the command. Value returned: '{}'".format(out))
Expand Down
2 changes: 2 additions & 0 deletions mycodo/utils/system_pi.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,8 @@ def internet(host="8.8.8.8", port=53, timeout=3):
def str_is_float(text):
"""Returns true if the string represents a float value"""
try:
if not text:
return False
if text.isalpha():
return False
float(text)
Expand Down

0 comments on commit 74211b3

Please sign in to comment.