Python 3 and ZeroBorg.py

I've been trying to use python 3.6 and have had a couple of problems with ZeroBorg.py

I've sorted some issues (mostly with print() ) and it seems to work, but i don't know if there are other things that should have been changed that might cause me problems in the future.

Is a python 3 version of the code likely to be available at any point?

Thanks,

piborg's picture

We do not have an official Python 3 version of ZeroBorg.py, however I think the only problem should really be with the print calls.

Did you find anything else that needed changing to support Python 3?

This link should explain what has changed between Python 2 and 3:
https://docs.python.org/3/howto/pyporting.html

Ok, thanks,

Looking back I think it was just changes to print

Hi,
Asked on twitter and got pointed here - trying to get ZeroBorg.py working on Python 3.5.3, keep getting an error saying Zeroborg missing. Your python 2 code works perfectly. Any tips?
Many thanks!

piborg's picture

We now have a Python 3 library available for download :)

You can download the script to your Raspberry Pi with these commands:

cd ~/zeroborg
wget -O ZeroBorg3.py http://forum.piborg.org/sites/default/files/forum_upload/piborg/ZeroBorg3.txt
chmod +x *.py

Make sure you get the correct upper / lower case letters in the commands above, otherwise they will not work.

To modify any of the existing examples to use this version simply replace this line:

import ZeroBorg

with

import ZeroBorg3 as ZeroBorg

The missing error is usually caused by not having the ZeroBorg.py / ZeroBorg3.py file in the same directory as the script you are running.

You can get around the problem by either copying the file into the same directory, or adding the ZeroBorg directory to the Python search path before importing it like this:

import sys
sys.path.append('/home/pi/zeroborg')
import ZeroBorg3 as ZeroBorg
Attachments: 

You've made my day! Thanks!

Subscribe to Comments for "Python 3 and ZeroBorg.py "