Within IronPython 2.7, I am running a few calls to a .Net dll :
from System.Guid import NewGuid, ToByteArray
from System import Array, Byte
import clr
clr.AddReferenceToFile( ThePathToDLLFile )
from MyDLL import *
...
g = NewGuid()
buffer = ToByteArray(g)
ret = myDllMethodToFillBuffer( buffer )
Some methods like 'myDllMethod' return a buffer of type Array[byte]:
>>> type(buffer)
<type 'Array[Byte]'>
I am strugling to find the right way to convert the Array[byte] to Python 'string byte', IE '\x01\x02\x03 ...'
After a bit of googling I found the way to do the opposite conversion (string byte to byte[array])
byteArray = Array[Byte](ord(c) for c in byteList)
How should I convert a variable length byte[array] to string byte?