BerlinUnited/RoboCupTools

gopro v2.0: TypeError: unsupported operand type

Closed this issue · 3 comments

Updated to the new Version.

gopro start

results in this error

pi@pi104:~/RoboCupTools/GoPro $ Traceback (most recent call last):
  File "/home/pi/RoboCupTools/GoPro/main.py", line 13, in <module>
    from scripts import check_gamecontroller, check_bluetooth, video_rename, wake_up_gopro, pair_bluetooth
  File "/home/pi/RoboCupTools/GoPro/scripts/check_bluetooth.py", line 3, in <module>
    from services.gopro.GoProCam import Bluetooth
  File "/home/pi/RoboCupTools/GoPro/services/gopro/GoProCam.py", line 19, in <module>
    from services.gopro.GoPro import GoPro
  File "/home/pi/RoboCupTools/GoPro/services/gopro/GoPro.py", line 14, in <module>
    class GoPro(threading.Thread, metaclass=ABCMeta):
  File "/home/pi/RoboCupTools/GoPro/services/gopro/GoPro.py", line 473, in GoPro
    def _last_video(self) -> str|None:
TypeError: unsupported operand type(s) for |: 'type' and 'NoneType'

Python version

pi@pi104:~/RoboCupTools/GoPro $ .venv/bin/python --version
Python 3.9.2

This is due to Union types were introduced with 3.10 (https://peps.python.org/pep-0604/).

efcy commented

@strouble which Pi and which os did you use? Was python 3.10 the default python or did you need to install that additionally?

Python 3.10 was just the one i was using on my local development machine -- nothing intentional.

I've now tested it on:

  • Raspberry Pi OS (Bookworm); Python 3.11
  • Ubuntu 24.04 LTS; Python 3.9
  • Ubuntu 24.04 LTS; Python 3.11