Re: [IronPython] How to convert a 'str' type to byteArray

2009-11-12 Thread matan keret
Thank you all for your help! i tried the buffer idea, but it gave me a 'buffer' type and not a byteArray. so i tried Michael's idea, which gave me some error. but then I found this post: http://www.smallshire.org.uk/sufficientlysmall/tag/ironpython/ I fixed the code to: from System import Array,

[IronPython] How to convert a 'str' type to byteArray

2009-11-11 Thread matan keret
hi, I have the following code which gets an image from an email. after getting it i need to pass it as a byteArray (byte[] in C#) to a C# function. i tried all sorts of things but no luck. I'm using ironPython 2.0.3 the important parts of the code are: # getting the image from the e-mail image

Re: [IronPython] How to convert a 'str' type to byteArray

2009-11-11 Thread Michael Foord
matan keret wrote: hi, I have the following code which gets an image from an email. after getting it i need to pass it as a byteArray (byte[] in C#) to a C# function. i tried all sorts of things but no luck. I'm using ironPython 2.0.3 the important parts of the code are: # getting the

Re: [IronPython] How to convert a 'str' type to byteArray

2009-11-11 Thread Vernon Cole
Make sure what data type is really being returned by part.getpayload() . Perhaps it is already in a suitable for when you get it? The Python 2.x language method of loading a binary blob of memory is to use the built in function buffer s = 'this is a string' b = buffer(s) b will be accepted my a

Re: [IronPython] How to convert a 'str' type to byteArray

2009-11-11 Thread Toni Alatalo
Vernon Cole kirjoitti: Make sure what data type is really being returned by part.getpayload() . Perhaps it is already in a suitable for when you get it? Before he posted to the list we actually talked about this on irc too, and it seemed that it was unicode. He was seeing type 'str', but it