diff options
author | Dmitry Moiseev <m0sia@m0sia.ru> | 2013-11-08 21:44:07 +0600 |
---|---|---|
committer | Dmitry Moiseev <m0sia@m0sia.ru> | 2013-11-08 21:44:07 +0600 |
commit | af533148a958014b95120bc95127d2150d859ca5 (patch) | |
tree | b0f78e8a0faa6cbe710f1e6ee94c5279b26697db | |
parent | c06e99e21b436dab67a33915cfd91ee5b901dd7d (diff) | |
download | pyParrotZikTCP-af533148a958014b95120bc95127d2150d859ca5.tar.xz pyParrotZikTCP-af533148a958014b95120bc95127d2150d859ca5.zip |
Sometimes Zik returns empty string instead of battery level
-rw-r--r-- | ParrotZik.py | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/ParrotZik.py b/ParrotZik.py index 08b7f30..b7f5dd7 100644 --- a/ParrotZik.py +++ b/ParrotZik.py @@ -13,8 +13,7 @@ class ParrotZik(object): if len(service_matches) == 0: print "Couldn't find Parrot Zik" - self.sock = '' - return + return False first_match = service_matches[0] port = first_match["port"] @@ -88,11 +87,7 @@ class ParrotZik(object): return self.sendMessage(message) def sendMessage(self,message): - try: - self.sock.send(str(message)) - except: - self.sock = '' - return + self.sock.send(str(message)) data = self.sock.recv(7) len = struct.unpack('B', data[1])[0] data = self.sock.recv(1024) |