Finally did it, thank you all for your help, the code i will upload because can be used by Python 3 for handle the wsgi issue of the Bytes!<br />Almar, sorry for the mails gmails sometimes sucks!!<br /><br />On Oct 14, 2010 1:00pm, hidura@gmail.com wrote:<br />> Finally did it, thank you all for your help, the code i will upload because can be used by Python 3 for handle the wsgi issue of the Bytes!<br />> <br />> On Oct 12, 2010 5:28pm, Almar Klein almar.klein@gmail.com> wrote:<br />> > <br />> > <br />> > <br />> >     So if you can, you could make sure to send the file as just bytes,<br />> > <br />> >     or if it must be a string, base64 encoded. If this is not possible<br />> > <br />> >     you can try the code below to obtain the bytes, not a very fast<br />> > <br />> >     solution, but it should work (Python 3):<br />> > <br />> > <br />> > <br />> > <br />> > <br />> >     MAP = {}<br />> > <br />> >     for i in range(256):<br />> > <br />> >          MAP[tmp] = eval("'\\u%04i'" % i)<br />> > <br />> > <br />> > <br />> > ><br />> > <br />> > >     # Let's say 'a' is your string<br />> > <br />> > >     b''.join([MAP[c] for c in a])<br />> > <br />> > ><br />> > <br />> > <br />> > <br />> > <br />> > I don't know what you're trying to do here.<br />> > <br />> > <br />> > <br />> > 1. 'tmp' is the same for every iteration of the 'for' loop.<br />> > <br />> > <br />> > <br />> > 2. A Unicode escape sequence expects 4 hexadecimal digits; the 'i'<br />> > <br />> > format gives a decimal number.<br />> > <br />> > <br />> > <br />> > 3. Using 'eval' to make a string this way is the long (and wrong) way<br />> > <br />> > to do it; chr(i) would have the same effect.<br />> > <br />> > <br />> > <br />> > 4. The result of the eval is a string, but you're performing a join<br />> > <br />> > with a bytestring, hence the exception.<br />> > Mmm, you're right. I didn't look at this carefully enough, and then made an error in copying the source code. Sorry for that ...<br />> > <br />> > Here's a solution that should work (if I understand your problem correctly):<br />> > <br />> > your_bytes = bytes([ord(c) for c in your_string])<br />> > <br />> >   Almar<br />> > <br />> > <br />> >