input return integer not string

Change return type of subprocess result to int and update error handling.
master-b-gpio
Alan Johnston 1 month ago committed by GitHub
parent e7b66a1a65
commit 04cdbd68a1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -26,13 +26,13 @@ def input(pin):
print(f"Command run was: {query}")
print("Sucess!")
print(f"Output of the command (stdout): {result}")
return result
return int(result)
except subprocess.CalledProcessError as e:
print(f"Command failed with return code: {e.returncode}")
print(f"Command run was: {e.cmd}")
print(f"Output of the command (stdout): {e.stdout}")
print(f"Error output of the command (stderr): {e.stderr}")
return 0
return -1
def setup(pin, config):
if config == "in" or config == "out" or config == "up" or config == "down":

Loading…
Cancel
Save

Powered by TurnKey Linux.