BrickPi.py changes to make compatible with Python 3.x

I’ve made some small changes to BrickPi.py to make it compatible with Python3. mostly just changing all “/” to “//” and using bytearray instead of strings for the buffers.

What’s the preferred way to submit this for consideration of merging into the codebase? Should I fork onto my own Github? or is there a way I could check in on a “Contrib” branch?

thanks

Thanks! Is it still backward compatible with 2.7?

I’m only working with motors right now, so I have no code to test the sensors, but the motor code works on both python2.7 and python3.2. So the Rx and Tx functions are clearly working. But there may be other bugs.

Hi,
I was just about to do this same port today - any chance I can get a copy of the code? Assume you also ported the scratch.py module? BTW, I have a lot of the sensors, so I’d be happy to beta test for you.

Thanks,
Shari

here’s the file…

it’s branched from the main about the time that I posted the first message… I later realized that I wanted to write my own firmware, so abandoned working on BrickPi_Python for now.

Note: I also posted a message about adding a flage to setup.py “zip_safe=False” which fixes the setup so that you don’t have to remove old versions when you install…

trying again with a gzip file.

Awesome, Thanks! I’ll keep you posted on my progress.

Anybody ever get this finished?

Hey cbjorgol,
Most of the BrickPi library is python3 compatible. I believe that the only thing not compatible are the prints which just need a brackets in the front and end. It should be easy to make those changes if you want to use it right now. We’ll update the library in the next few days and make it Python3 compatible.

-Karan

Very much looking forward to Python 3 compatibility, so thanks for sticking with it!

Hi Donald-braman
The BrickPi.py library is Python3 compatible. Some of the examples are not there yet, they only need a small change to their print statements.

To enable Python 3 support, you do need to do the following:
start a terminal window (or SSH in)
cd ~/Desktop/BrickPi_Python
sudo python3 setup.py install

This will make the library available to python3

Cleo