Skip to content

TypeError when sending query using python3 #16

@PidgeyL

Description

@PidgeyL

running this code:

import osquery
CLIENT = osquery.ExtensionClient()
CLIENT.open()
RESULTS = CLIENT.extension_client().query(sys.argv[1])

results in the following error:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.4/dist-packages/osquery-1.5.3-py3.4.egg/osquery/extensions/ExtensionManager.py", line 183, in query
  File "/usr/local/lib/python3.4/dist-packages/osquery-1.5.3-py3.4.egg/osquery/extensions/ExtensionManager.py", line 187, in send_query
  File "/usr/local/lib/python3.4/dist-packages/thrift/protocol/TBinaryProtocol.py", line 46, in writeMessageBegin
    self.writeI32(TBinaryProtocol.VERSION_1 | type)
  File "/usr/local/lib/python3.4/dist-packages/thrift/protocol/TBinaryProtocol.py", line 111, in writeI32
    self.trans.write(buff)
  File "/usr/local/lib/python3.4/dist-packages/thrift/transport/TTransport.py", line 168, in write
    raise e
  File "/usr/local/lib/python3.4/dist-packages/thrift/transport/TTransport.py", line 164, in write
    self.__wbuf.write(buf)
TypeError: string argument expected, got 'bytes' 

when ran using python3.

Should I run this code differently, when using python3, or is this a bug?

Thanks in advance

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions