question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Mac OS X python 2.7.15 AttributeError: 'module' object has no attribute 'map_name'

See original GitHub issue

I have a third party python program that imports keyboard.

I did a pip install keyboard and when I saw a Quartz dependency error, I did a pip install pyobc.

When the program wants to receive a key press from me I get:

Exception in thread Thread-5:
Traceback (most recent call last):
  File "/usr/local/Cellar/python@2/2.7.15/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py", line 801, in __bootstrap_inner
    self.run()
  File "/usr/local/Cellar/python@2/2.7.15/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py", line 754, in run
    self.__target(*self.__args, **self.__kwargs)
  File "/usr/local/lib/python2.7/site-packages/keyboard/_darwinkeyboard.py", line 371, in run
    Quartz.CFRunLoopRunInMode(Quartz.kCFRunLoopDefaultMode, 5, False)
  File "/usr/local/lib/python2.7/site-packages/keyboard/_darwinkeyboard.py", line 400, in handler
    self.callback(KeyboardEvent(event_type, scan_code, name=key_name, is_keypad=is_keypad))
  File "/usr/local/lib/python2.7/site-packages/keyboard/__init__.py", line 251, in direct_callback
    if is_modifier(event.scan_code): self.active_modifiers.add(event.scan_code)
  File "/usr/local/lib/python2.7/site-packages/keyboard/__init__.py", line 142, in is_modifier
    _modifier_scan_codes.update(*scan_codes)
  File "/usr/local/lib/python2.7/site-packages/keyboard/__init__.py", line 141, in <genexpr>
    scan_codes = (key_to_scan_codes(name, False) for name in all_modifiers)
  File "/usr/local/lib/python2.7/site-packages/keyboard/__init__.py", line 319, in key_to_scan_codes
    t = tuple(_collections.OrderedDict((scan_code, True) for scan_code, modifier in _os_keyboard.map_name(normalized)))
AttributeError: 'module' object has no attribute 'map_name'

This same program works apparently for windows users.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
jsolderitschcommented, May 11, 2018

Thanks for the confirmation – not just me then.

1reaction
JoffreyPoreeCodingcommented, May 11, 2018

Same issue here…

Read more comments on GitHub >

github_iconTop Results From Across the Web

'module' object has no attribute 'fsdecode'; PYTHON 2.7; mac ...
AttributeError : 'module' object has no attribute 'fsdecode'; PYTHON 2.7; mac os X · It says that the 'os' module has no function...
Read more >
Install Python, NumPy, SciPy, and matplotlib on Mac OS X
Go to the Python download page and download the package called Python 2.7.2 Mac OS X 64-bit/32-bit x86-64/i386 Installer.
Read more >
python3 time module misses attributes in Mac installers
The issue: AttributeError: module 'time' has no attribute 'clock_gettime'. It probably missed other attributes as well.
Read more >
'MacOSXOSAScript' object has no attribute 'basename'
AttributeError : 'MacOSXOSAScript' object has no attribute 'basename'.
Read more >
AttributeError: 'module' object has no attribute and ImportError
This video covers the AttributeError : ' module ' object has no attribute and ImportError: No module name errors in Python.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found