Please let me know if I should provide any more information.
I'm trying to connect a pihut controller to a raspberry pi zero using code I found from approxeng. I am running python 3.5. https://approxeng.github.io/approxeng.input/simpleusage.html#connecting-to-a-controller
from approxeng.input.selectbinder import ControllerResource
while True:
try:
with ControllerResource() as joystick:
print('Found a joystick and connected')
while joystick.connected:
# Do stuff with your joystick here!
# ....
# ....
# Joystick disconnected...
print('Connection to joystick lost')
except IOError:
# No joystick found, wait for a bit before trying again
print('Unable to find any joysticks')
sleep(1.0)
However, every time I run this code, or some similar code, I get the same error
File "/usr/local/lib/python3.5/dist-packages/approxeng/input/__init__.py", line 375
xname = f'{rootname}x'
^
SyntaxError: invalid syntax
Upon inspecting this file (found here https://github.com/ApproxEng/approxeng.input/blob/master/src/python/approxeng/input/init.py), at line 375 I find
# Look to see whether we've got pairs of lx,ly and / or rx,ry and create corresponding circular axes
def add_circular_axis(rootname):
xname = f'{rootname}x'
yname = f'{rootname}y'
if xname in self.axes_by_sname and yname in self.axes_by_sname:
self.axes_by_sname[rootname] = CircularCentredAxis(x=self.axes_by_sname[xname],
y=self.axes_by_sname[yname])
I can't edit this file as it's write-protected, and even if I could edit it, I'm not sure what to do. How can I stop getting this error?