Skip to content
Snippets Groups Projects
Commit fc7ce0d4 authored by Andrew Tridgell's avatar Andrew Tridgell
Browse files

pymavlink: fixed assumption that type(x) returns just the type

it returns "<type 'bytearray'>" on some versions of python
parent 8f5b0654
Branches master
No related tags found
No related merge requests found
...@@ -760,10 +760,9 @@ class mavserial(mavfile): ...@@ -760,10 +760,9 @@ class mavserial(mavfile):
def write(self, buf): def write(self, buf):
try: try:
if type(buf) == 'str': if not isinstance(buf, str):
return self.port.write(buf) buf = str(buf)
if type(buf) == 'bytearray': return self.port.write(buf)
return self.port.write(str(buf))
except Exception: except Exception:
if not self.portdead: if not self.portdead:
print("Device %s is dead" % self.device) print("Device %s is dead" % self.device)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment