[Pythonedu-wg] Bit shift problem

Carrie Anne Philbin carrieanne at raspberrypi.org
Tue Dec 20 04:51:21 EST 2016


Just to add to what Laura has said. This resource is part of a global
weather experiment. We have 1000 schools around the world taking part and
we want them to be able to program them with Python as well as with Java.
Helping with the conversion from 2 to 3 would impact a lot of young people!

Thanks,

Carrie Anne

On Tue, Dec 20, 2016 at 9:38 AM, Laura Sach <lawsie at gmail.com> wrote:

> Hi all,
>
> I'm working on a resource which reads weather data, and I'm using this
> code to read data from a BMP180 barometric pressure sensor.
>
> https://github.com/lawsie/barometric-sensor
> <https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_lawsie_barometric-2Dsensor&d=DgMFaQ&c=DpyQ_ftY536pf7wCBQXXU58xADDRY77THQzJu1OmzOo&r=p4qOjPRR1KW_JcSTVo66U4oJ21Q6ryCXteaBg51D6Eo&m=M0KSOnlWfnqjx7yhGnbKu1goe2opZTJ9NYqpMPl-6z4&s=VRX_3_GiA9L13nO2xI9Kn423A0Jer9aa000aNlC60ec&e=>
>
> The code in the file bmpBackend_py3.py (and the Adafruit I2c/bmp085 files)
> was originally in Python 2 and I converted it using 2to3. However this has
> resulted in the bit shifts not working any more in the readPressure()
> method.
>
> This code works in Python 2 but I need the resource to be in Python 3.
> I've included the Python 2 bmpBackend file too for comparison in case the
> tool has changed something odd.
>
> I predict the problem is to do with the redefinition of the / operator
> from 2 to 3, but I don't know enough about bit shifting to figure out what
> to do to resolve it.
>
> Would anyone be able to help me to get this working? :)
>
> Many thanks,
> Laura
>
>
>
>
>
> _______________________________________________
> Pythonedu-wg mailing list
> Pythonedu-wg at python.org
> https://mail.python.org/mailman/listinfo/pythonedu-wg
>
>


-- 
Director of Education
Raspberry Pi Foundation
UK Charity No. 1129409

www.raspberrypi.org | www.codeclub.org.uk
@ <http://twitter.com/missphilbin> | in
<https://uk.linkedin.com/in/carrie-anne-philbin-a20649b7> | *▷*
<https://www.youtube.com/user/GeekGurlDiaries>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/pythonedu-wg/attachments/20161220/518c76c2/attachment.html>


More information about the Pythonedu-wg mailing list