Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Examples fail to run with error "AttributeError: 'AsyncWorker' object has no attribute 'isAlive'" #10

Open
aunitt opened this issue Mar 29, 2022 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@aunitt
Copy link

aunitt commented Mar 29, 2022

After installing the code I get the following error:

Traceback (most recent call last):
File "/home/pi/Pimoroni/gfxhat/examples/hello-world.py", line 55, in
touch.on(x, handler)
File "/usr/local/lib/python3.9/dist-packages/gfxhat/touch.py", line 119, in on
register(handler)
File "/usr/local/lib/python3.9/dist-packages/gfxhat/touch.py", line 114, in register
_cap1166.on(channel=button, event='press', handler=handler)
File "/usr/lib/python3/dist-packages/cap1xxx.py", line 386, in on
self.start_watching()
File "/usr/lib/python3/dist-packages/cap1xxx.py", line 400, in start_watching
self.async_poll.start()
File "/usr/lib/python3/dist-packages/cap1xxx.py", line 208, in start
if self.isAlive() == False:
AttributeError: 'AsyncWorker' object has no attribute 'isAlive'
Error in atexit._run_exitfuncs:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/cap1xxx.py", line 409, in stop_watching
self.async_poll.stop()
File "/usr/lib/python3/dist-packages/cap1xxx.py", line 213, in stop
if self.isAlive() == True:
AttributeError: 'AsyncWorker' object has no attribute 'isAlive'
Exception ignored in: <function Cap1xxx.del at 0x76690460>
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/cap1xxx.py", line 522, in del
File "/usr/lib/python3/dist-packages/cap1xxx.py", line 409, in stop_watching
File "/usr/lib/python3/dist-packages/cap1xxx.py", line 213, in stop
AttributeError: 'AsyncWorker' object has no attribute 'isAlive'

I've tried installing by running:
sudo pip3 install gfxhat
and
curl https://get.pimoroni.com/gfxhat | bash
and cloning the github repository and running:
sudo python3 setup.py install

I did a pip install first.

It appears the pip install installs Cap1xxx 0.1.3, pip show Cap1xxx gives me:
Name: Cap1xxx
Version: 0.1.3
Summary: A module to drive various Microchip cap1xxx touch ICs
Home-page: http://shop.pimoroni.com
Author: Philip Howard
Author-email: [email protected]
License: MIT
Location: /usr/lib/python3/dist-packages
Requires: RPi.GPIO
Required-by: gfxhat, touchphat, pianohat, ExplorerHAT, drumhat

Running
sudo pip install Cap1xxx==0.1.4
got the example code to run.

@Gadgetoid Gadgetoid added the bug Something isn't working label Mar 29, 2022
@Gadgetoid
Copy link
Member

Thank you. I thought I'd caught all of these but Graphics HAT slipped my mind.

@gallanwood
Copy link

Thanks aunitt! Your fix worked for me but took some finding.
Seems like curl https://get.pimoroni.com/gfxhat | bash is unreliable.

@mmozzano
Copy link

mmozzano commented Feb 1, 2023

@Gadgetoid - I've just recieved my gfxhat for a project and the install script still isn't working correctly - I had to manually install Cap1xxx 0.1.4 as mentioned by @aunitt above.

Another small issue, when running any of the examples you now get the following:

/home/user/hello-world.py:31: DeprecationWarning: getsize is deprecated and will be removed in Pillow 10 (2023-07-01). Use getbbox or getlength instead.

Change -

w, h = font.getsize(text)
x = (width - w) // 2
y = (height - h) // 2

To:

l, t, r, b = font.getbbox(text)
x = (width - r-l) // 2
y = (height - b) // 2

@Gadgetoid Gadgetoid self-assigned this Feb 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants