klattimer/LGWebOSRemote

Broken on Python 3.11

Igetin opened this issue · 2 comments

Running the program on Python 3.11 gives the following output:

Traceback (most recent call last):
  File "/usr/local/bin/lgtv", line 33, in <module>
    sys.exit(load_entry_point('LGTV==0.3', 'console_scripts', 'lgtv')())
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/bin/lgtv", line 25, in importlib_load_entry_point
    return next(matches).load()
           ^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.11/importlib/metadata/__init__.py", line 198, in load
    module = import_module(match.group('module'))
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.11/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1206, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1178, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1149, 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 "/home/ige/.local/lib/python3.11/site-packages/LGTV/__init__.py", line 3, in <module>
    from inspect import getargspec
ImportError: cannot import name 'getargspec' from 'inspect' (/usr/lib64/python3.11/inspect.py)

i got it fixed by replacing from inspect import getargspec to from inspect import getfullargspec in python3.11/dist-packages/LGTV/init.py and replace getargspec with getfullargspec in args = getfullargspec(LGTVRemote.__dict__[c]) and args = getfullargspec(LGTVRemote.__dict__[command])

A patch was submitted for this and the issue is fixed.