Reputation: 1
When ever I run
import keyboard if keyboard.is_pressed('q'):
while True:
print("bean")
else:
quit()
I get this error:
Exception in thread Thread-1:
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/threading.py", line 954, in _bootstrap_inner
Could someone please help could this possibly be the fact that im on a Mac or am I just dumb
Upvotes: 0
Views: 514
Reputation: 66
Problem 1:
Your import and if should not be on the same line. Import then begin if statement
Problem 2:
You have an infinite loop created by your while True with no exit. I think your intention is probably to print “bean” as long as q is pressed. If this is the case your if probably needs to be inside your while loop.
You are bound to have further problems after working those out but isn’t that point and enjoyment of programming?
Upvotes: 1