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
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
> > > > issue, for instance:
> > > > self.out.write("%c" % y) is also
R. David Murray wrote:
...
Here is some example code that works:
out=open('temp', "wb")
out.write(b"BM")
def write_int(out, n):
bytesout=bytes(([n&255), (n>>8)&255, (n>>16)&255, (n>>24)&255])
out.write(bytesout)
write_int(out, 125)
or even:
import struct
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
> > > issue, for instance:
> > > self.out.write("%c" % y) is also giving me the same error as the other
> > > sta
walle...@gmail.com wrote:
Thanks for the assist. One more question, please.
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("%c" %y),
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
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("%c" %y),encoding=utf-8) in an attempt to
> convert to bytes
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.