diff --git a/geomagio/edge/RawInputClient.py b/geomagio/edge/RawInputClient.py
index 5bcb7d7210a6a00703a9cdab4f517737682e67d9..eeea3889b617e101c5438be1a9bd4a40d066f357 100644
--- a/geomagio/edge/RawInputClient.py
+++ b/geomagio/edge/RawInputClient.py
@@ -321,7 +321,8 @@ class RawInputClient():
         ratemantissa, ratedivisor = self._get_mantissa_divisor(rate)
 
         packStr = '%s%d%s' % (PACKSTR, nsamp, 'i')
-        buf = struct.pack(packStr, PACKETHEAD, nsamp, self.seedname, yr, doy,
+        bpackStr = str.encode(packStr)
+        buf = struct.pack(bpackStr, PACKETHEAD, nsamp, self.seedname, yr, doy,
                 ratemantissa, ratedivisor, self.activity, self.ioclock,
                 self.quality, self.timingquality, secs, usecs, self.sequence,
                 *samples)