Skip to content

AttributeError: 'PyKeyboard' object has no attribute 'left_key' #121

Description

@kadanes

I am following the readme and getting this error.

>>> from pykeyboard import PyKeyboard
>>> k = PyKeyboard()
>>> k.tap_key(k.left_key);
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'PyKeyboard' object has no attribute 'left_key'

So I tried using the x11 file because I saw that base didn't really have any definitions.

>>> from pykeyboard.x11 import PyKeyboard
>>> k = PyKeyboard()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/Parth/opt/anaconda3/lib/python3.7/site-packages/pykeyboard/x11.py", line 41, in __init__
    self.display = Display(display)
  File "/Users/Parth/opt/anaconda3/lib/python3.7/site-packages/Xlib/display.py", line 89, in __init__
    self.display = _BaseDisplay(display)
  File "/Users/Parth/opt/anaconda3/lib/python3.7/site-packages/Xlib/display.py", line 71, in __init__
    protocol_display.Display.__init__(self, *args, **keys)
  File "/Users/Parth/opt/anaconda3/lib/python3.7/site-packages/Xlib/protocol/display.py", line 84, in __init__
    name, protocol, host, displayno, screenno = connect.get_display(display)
  File "/Users/Parth/opt/anaconda3/lib/python3.7/site-packages/Xlib/support/connect.py", line 73, in get_display
    return mod.get_display(display)
  File "/Users/Parth/opt/anaconda3/lib/python3.7/site-packages/Xlib/support/unix_connect.py", line 76, in get_display
    raise error.DisplayNameError(display)
Xlib.error.DisplayNameError: Bad display name "/private/tmp/com.apple.launchd.mzfduZgMBG/org.macosforge.xquartz:0"

Finally, I tried using mac.py. But that file does not have all the keys defined. And the ones that are defined don't work.

>>> from pykeyboard.mac import PyKeyboard
>>> k = PyKeyboard()
>>> k.tap_key('UP_ARROW_KEY');

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions