While I know nothing of Python 3, the use of 'and' instead of '&' as a bitwise operator is clearly incorrect. I suspect your Python 2 code is also correct in Python 3.supra wrote:Using Model B 512MB, python3.2.3.3, 2014-01-07 wheezy raspbian
Does anyone knows how to convert from 2.7 to 3.2.3?
python2.x:I converted to python3.2.3:Code: Select all
data = (data & 0x0F)<< 4 #shift 4 bits to leftThe error stating:Code: Select all
data = (data and 0x0F)<< 4 #shift 4 bits to left
TypeError: unsigned operand type(s) for <<: 'NoneType' and 'int'