[IronPython] Functions requiring a byte[]

Josh Green inbilla at gmail.com
Sat Feb 14 13:14:47 CET 2009

Hi Guys,

Just to be honest from the start, I am a .NET/Python newbie, I'm at home in
standard C++ so please bare with me!

Bascially an application that I am trying to script (FX Composer) uses
IronPython. One of the .NET methods exposed into python bares the following

public void LoadRawData(byte[] bytes, int width, int height, int depth,
FXComposer.Scene.FXFormat format, FXComposer.Scene.Effects.FXSurfaceType

Now, my problem lies in passing information into that function in the form
of "byte[]".
How can I generate a value that this function will accept in that spot?

I have tried the following:
img.LoadRawData([255,255,255,0,0,0,0,0,0,255,255,255], 2, 2, 3,
FXFormat.R8G8B8, FXSurfaceType.Surface2D)

But it complains with the following error:
TypeError: expected Array, got list
CLR Exception:
expected Array, got list

So I assume I have to create an array somehow... But I don't know how!

Any help you guys can give me would be fantastic, and any suggestions of
places where I might find relevant documentation on these issues (CLR type
conversion to Python types, etc) I would be grateful for your advice.

Thanks for your time

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20090214/588746cb/attachment.html>

More information about the Ironpython-users mailing list