Re: pygtk beginner script not working

2015-11-15 Thread kent nyberg
On Sat, Nov 14, 2015 at 05:00:59PM -0800, ja...@imagewebdesign.co.uk wrote: > Hi guys > > I'm new to Python so please bare with me :) > > I'm using python 2.7.10 as advised (more tools apparently over 3.x) > > Trying to use this script > > [CODE] > #!/usr/bin/env python > > # example base.py

Re: Problems using struct pack/unpack in files, and reading them.

2015-11-13 Thread kent nyberg
The main problem was that I forgot to do seek(0). Thanks alot people. Though, as many times before, the problem was due to misunderstanding of how python works. I assumed file.read()[xx:yy] was to be understood as, in the file, read from index xx to place yy. That is, [10:20] was the same a

Re: Problems using struct pack/unpack in files, and reading them.

2015-11-13 Thread kent nyberg
On Fri, Nov 13, 2015 at 12:36:22PM -0700, Ian Kelly wrote: > On Fri, Nov 13, 2015 at 12:20 PM, kent nyberg wrote: > > def LoadCommandAndReact(place_to_read): > > global RegisterAX > > > > tmp = place_to_read.read()[RegisterAX:calcsize('HH')] > >

Problems using struct pack/unpack in files, and reading them.

2015-11-13 Thread kent nyberg
Hi there, Im deeply sorry for yet another question to this list. I have come across a problem to which google seems not to eager to supply the anwser. The problem is the following. First I do this: def setup_drive(): test = pack('>HH', 0b1000, 0b10010001) file = op

Re: bitwise operator, bits dont go into bitbucket..?

2015-11-10 Thread kent nyberg
On Wed, Nov 11, 2015 at 09:33:38AM +1100, Chris Angelico wrote: > On Wed, Nov 11, 2015 at 9:27 AM, kent nyberg wrote: > > If you want to check specific bits (in C or Python, either way), it's > much more common to use bitwise AND than bit shifts: > > >>> 0b100

bitwise operator, bits dont go into bitbucket..?

2015-11-10 Thread kent nyberg
Im reading about bitwise operators and is it true to say they dont work 100% as in C? bitwise operators in C seem to result in bits going to the so called bitbucket. For example, 0b0001. Shifting it >> 1 in C it seems to add on zero to the left and the 1 to the right gets throwned away. Bu

Re: using binary in python

2015-11-10 Thread kent nyberg
On Mon, Nov 09, 2015 at 10:20:25PM -0800, Larry Hudson via Python-list wrote: > Your questions are somewhat difficult to answer because you misunderstand > binary. The key is that EVERYTHING in a computer is binary. There are NO > EXCEPTIONS, it's all binary ALL the time. The difference comes ab

using binary in python

2015-11-09 Thread kent nyberg
a binary file? Thanks alot, and forgive me for my stupid questions. :) /Kent Nyberg -- https://mail.python.org/mailman/listinfo/python-list