input return int of stdout

master-b-gpio
Alan Johnston 1 month ago committed by GitHub
parent 04cdbd68a1
commit eae73235b4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -25,8 +25,8 @@ def input(pin):
result = subprocess.run(query, capture_output=True, text=True, check=True) result = subprocess.run(query, capture_output=True, text=True, check=True)
print(f"Command run was: {query}") print(f"Command run was: {query}")
print("Sucess!") print("Sucess!")
print(f"Output of the command (stdout): {result}") print(f"Output of the command (stdout): {result.stdout}")
return int(result) return int(result.stdout)
except subprocess.CalledProcessError as e: except subprocess.CalledProcessError as e:
print(f"Command failed with return code: {e.returncode}") print(f"Command failed with return code: {e.returncode}")
print(f"Command run was: {e.cmd}") print(f"Command run was: {e.cmd}")

Loading…
Cancel
Save

Powered by TurnKey Linux.