setstatus.py: fix bug for setting status variable

This commit is contained in:
berhsi 2019-07-27 18:14:13 +02:00
parent 397ed52696
commit 6143456d35

View file

@ -1,11 +1,11 @@
#!/usr/bin/python3 #!/usr/bin/python3
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# file: client-clear.py # file: setstatus.py.py
# date: 26.07.2019 # date: 26.07.2019
# email: berhsi@web.de # email: berhsi@web.de
# client, who connects to nr18.space at port 10001 to update the krautspace # client, who connects to the statusserver at port 10001 to update the krautspace
# door status. If no status is given as argument, he reads from stdin until # door status. If no status is given as argument, he reads from stdin until
# input is 0 or 1. # input is 0 or 1.
@ -51,7 +51,7 @@ def read_argument():
def main(*status): def main(*status):
HOST = 'localhost' HOST = 'nr18.space'
PORT = 10001 PORT = 10001
BOM = byteorder BOM = byteorder
STATUS = None STATUS = None
@ -66,6 +66,8 @@ def main(*status):
STATUS = read_argument() STATUS = read_argument()
else: else:
STATUS = check_arguments(argv) STATUS = check_arguments(argv)
if STATUS == None:
STATUS = read_argument()
with socket.socket(socket.AF_INET, socket.SOCK_STREAM, 0) as mySocket: with socket.socket(socket.AF_INET, socket.SOCK_STREAM, 0) as mySocket:
print('Socket created') print('Socket created')