stuartlangridge / hushboard

Mute your mic while you're typing. An app for Ubuntu.
https://kryogenix.org/code/hushboard/
MIT License
146 stars 12 forks source link

Runtime error: "AttributeError: module 'inspect' has no attribute 'getargspec'. Did you mean: 'getargs'?" - installed from AUR #27

Open peter-lyons-kehl opened 7 months ago

peter-lyons-kehl commented 7 months ago

Thank you Stuart @stuartlangridge for developing, and Jeffrey @jbouter for packaging on AUR.

Getting "AttributeError: module 'inspect' has no attribute 'getargspec'. Did you mean: 'getargs'?" on Manjaro (= pretty much stable Arch, current as of March 2024, stable kernel, GNOME 45.4, X11). Installed with Pacman from AUR (no errors/warnings reported during installation): image

# as non-root user - but the same error when run as root, too
❯ hushboard 
Traceback (most recent call last):
  File "/usr/bin/hushboard", line 33, in <module>
    sys.exit(load_entry_point('hushboard==0.0.1', 'console_scripts', 'hushboard')())
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/bin/hushboard", line 25, in importlib_load_entry_point
    return next(matches).load()
           ^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/importlib/metadata/__init__.py", line 202, in load
    module = import_module(match.group('module'))
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1147, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 940, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/usr/lib/python3.11/site-packages/hushboard/__main__.py", line 7, in <module>
    from . import pulsectl
  File "/usr/lib/python3.11/site-packages/hushboard/pulsectl.py", line 334, in <module>
    class Pulse(object):
  File "/usr/lib/python3.11/site-packages/hushboard/pulsectl.py", line 604, in Pulse
    card_profile_set_by_index = _pulse_method_call(
                                ^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/hushboard/pulsectl.py", line 596, in _pulse_method_call
    func_args = list(inspect.getargspec(func or (lambda: None)))
                     ^^^^^^^^^^^^^^^^^^
AttributeError: module 'inspect' has no attribute 'getargspec'. Did you mean: 'getargs'?

Background:

❯ which hushboard 
/usr/bin/hushboard

~ is 📦 v0.7.0 via  v20.4.0 via 🦀 v1.76.0-nightly 
❯ file /usr/bin/hushboard 
/usr/bin/hushboard: Python script, ASCII text executable

❯ vim /usr/bin/hushboard 

❯ head -n 2 /usr/bin/hushboard 
#!/usr/bin/python
# EASY-INSTALL-ENTRY-SCRIPT: 'hushboard==0.0.1','console_scripts','hushboard'

❯ /usr/bin/python --version
Python 3.11.7

I'm not a Python developer. If you'd like me to investigate, please suggest steps to do, or even better, commands to run.

stuartlangridge commented 7 months ago

Huh. OK, the problem is that Python's inspect.getargspec was deprecated when I used it (which I didn't realise) and has now been dropped (in your 3.11, but not in my 3.10). So I'll need to work out how to reimplement that bit in Proper Modern Code. Good catch!

rrthomas commented 3 weeks ago

30 fixes this.