error writing str to binary stream - fails in Python 3.0.1, works in 2.x

2009-03-16 Thread wallenpb
I am working with a bit of code that works ok in Python 2.x (tested fine in 2.5.4 and 2.6.1) but fails in 3.0.1. The code opens a file for binary output to witht the objective to produce a .bmp graphics file. The code below illustrates the first of several like errors when a str object is attempte

Re: error writing str to binary stream - fails in Python 3.0.1, works in 2.x

2009-03-16 Thread wallenpb
On Mar 16, 11:05 am, "R. David Murray" wrote: > walle...@gmail.com wrote: > > I am working with a bit of code that works ok in Python 2.x (tested > > fine in 2.5.4 and 2.6.1) but fails in 3.0.1. > > The code opens a file for binary output to witht the objective to > > produce a .bmp graphics file.

Re: error writing str to binary stream - fails in Python 3.0.1, works in 2.x

2009-03-16 Thread wallenpb
On Mar 16, 4:10 pm, Benjamin Peterson wrote: >   gmail.com> writes: > > > > > self.out.write(b'BM') worked beautifully.  Now I also have a similar > > issue, for instance: > > self.out.write("%c" % y) is also giving me the same error as the other > > statement did. > > I tried self.out.write(bytes

Re: error writing str to binary stream - fails in Python 3.0.1, works in 2.x

2009-03-17 Thread wallenpb
On Mar 16, 5:42 pm, John Machin wrote: > On Mar 17, 9:29 am, "R. David Murray" wrote: > > > > > walle...@gmail.com wrote: > > > On Mar 16, 4:10 pm, Benjamin Peterson wrote: > > > >   gmail.com> writes: > > > > > > self.out.write(b'BM') worked beautifully.  Now I also have a similar > > > > > iss