Skip to content

Commit

Permalink
Merge pull request #21 from alpacahq/fix-py2-write
Browse files Browse the repository at this point in the history
Fix python2 write
  • Loading branch information
umitanuki authored Sep 11, 2018
2 parents ecfe895 + 3de7892 commit cb24bb5
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pymarketstore/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import re
import requests
import logging
import six

from .jsonrpc import JsonRpcClient, MsgpackRpcClient
from .results import QueryReply
Expand Down Expand Up @@ -103,7 +104,8 @@ def write(self, recarray, tbk, isvariablelength=False):
]
data['names'] = recarray.dtype.names
data['data'] = [
bytes(memoryview(recarray[name]))
bytes(buffer(recarray[name])) if six.PY2
else bytes(memoryview(recarray[name]))
for name in recarray.dtype.names
]
data['length'] = len(recarray)
Expand Down

0 comments on commit cb24bb5

Please sign in to comment.