GFXHat

New GFX Hat delivered last week. Tested on pi4b and pi400. Using Thonny editor. Did full install as recommended and now have Pimoroni directory installed with GFX folder and examples shown. Running any examples results in 6 error codes shown in the shell.Hello world shows touch.on(X, handler) Line 55 error. The last error indicates AttributeError: AsyncWorker object has no attribute ’ isAlive’.
Points to cap1xxx.py file but that file not present.
Am very new to this python/ pi so may be making a stupid mistake at basic level. Can any one help please ?

Looks like there’s an open issue regarding this error here:

Sounds like upgrading the Cap1xxx library to the newest version might help?

sudo pip install Cap1xxx==0.1.4

updating the library has helped tremendously. now display lights okay when hello world run. scanning contrast example reports no contrast attribute in gfxhat.lcd and upinout can not find the yam module. Menu option works and so does touch. Any ideas…

It’s been a while since I’ve used GFX HAT, can you post the exact error text? I’m not sure what a yam module is 😅

Traceback (most recent call last):
File “/home/pi/Pimoroni/gfxhat/examples/upinout/upinout.py”, line 8, in
import yaml
ModuleNotFoundError: No module named ‘yaml’

Traceback (most recent call last):
File “/home/pi/Pimoroni/gfxhat/examples/contrast-scanner.py”, line 60, in
lcd.contrast(0)
AttributeError: module ‘gfxhat.lcd’ has no attribute ‘contrast’

Thanks - perhaps pip install pyyaml for the first one?

Thread that might be relevant to the second one here - looks like the one line installer might be serving up an out of date version of the library? Gfx-hat contrast problems

is there something missing in the install command ? terminal reports missing destination file operand after pyyam1. nb I am a real beginner at this game so don’t assume I know anything…

The contrast scanner now appears to work after entering the changes with a little adjustment to python version numbers.
going good here so far.

1 Like

Have got the pyyaml installed now, my error I think.
The example upinout now fails with the following;
Traceback (most recent call last):
File “/home/pi/Pimoroni/gfxhat/examples/upinout/upinout.py”, line 24, in
pinout = yaml.load(open(“pinout.yaml”).read())
TypeError: load() missing 1 required positional argument: ‘Loader’
Any immediate ideas ?

Bit late but I got it working by adding a loader argument to the yaml.load() line.

  • Opened the file by going to the directory and using: nano upinout.py
  • Find the line that is: pinout = yaml.load(open("pinout.yaml").read())
  • Specify a loader: pinout = yaml.load(open("pinout.yaml").read(), Loader=yaml.SafeLoader)
  • Save the changes with CTRL + O, press Enter to confirm the file name (will be the same), exit the editor with CTRL + X.
  • Should be good to go now by running python upinout.py again.