Question:
Dear, I do not manage to importer a "bytes" variable into a chilkat.CkAsn() structure. I check with
But but without success, i receive this error
Can you help me, Thanx in advance, Jacky
This has become a sticky issue since Python 3. When Chilkat was first released, only Python 2.* existed, and it was possible.
I think the best solution for now is to encode the bytes to base64 and use appendEncoded. For example:
import sys import chilkat import base64# Python 3 data = bytes([0x13, 0x00, 0x00, 0x00, 0x08, 0x00])
b64Str = base64.b64encode(data).decode('ascii') print(b64Str)
# Python 2 #data = ''.join(chr(x) for x in [0x41, 0x42, 0x43, 0x44, 0x45, 0x46])
bytedata = chilkat.CkByteData() bytedata.appendEncoded(b64Str,"base64")
bytedata.saveFile("out.dat")
I use the function asn.LoadEncoded(b64Str,"base64") and this OK.
a big thank you, I could never find without your help