john-38787364 / antifier

Convert the output from USB Tacx turbo trainers into ANT+ signals
MIT License
52 stars 20 forks source link

Python3 is not supported #13

Open hsamuels0 opened 6 years ago

hsamuels0 commented 6 years ago

I'm running this on a Arch Linux. Arch uses python3 as default python version. This means all when running the commands in the install.sh python3 is used. This causes an exception when you start the antifier.py.

+++ [shell]$ sudo python antifier.py File "antifier.py", line 454 if debug:print "get ant stick" ^ SyntaxError: Missing parentheses in call to 'print' +++

This error is caused by the change in print statement that requires a '()' around the print for ex 'print ("get ant stick")'. This should be easy to fix and as far as I know support later python2 releases. When that is done the antifier GUI starts, but when connecting the USB from the Tacx trainer, another exception shows up. So there is more things that needs fixing to make this python3 compatible. I'm not skilled enough to judge how much work that is and if that also would break python2 compatibility.

The simple solution for Arch linux is to use the 'python2' commands and start it under python2. No changes needed to the code.

Here is what you need to do: 'sudo pacman -S python2-pip tk' 'pip2 install pyserial pyusb numpy' As the install script will fail initializing python2 and add all this to python3 (which you do not need), it is probably easiest to just pull the whole antifier directory from github. If you do this with 'hub' it will be easy to keep the directory up to date as code progress. 'sudo pacman -S hub' 'hub clone https://github.com/john-38787364/antifier' A simple 'hub pull' when you are in the antifier directory will now update to latest version. Last step is to start antifier.py with python2. When you are in the antifier directory you do: 'sudo python2 antifier.py'

I have not worked with other distros in a while, but my assumption is that they have similar solutions to install and use python2, if they have already moved to Python3 as default python version.

I would suggest to add some information to the README or add a README_PYTHON3 with some suggestions if others run in to this.