Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

module 'inspect' has no attribute 'getargspec' #377

Open
Timoses opened this issue Jun 30, 2023 · 3 comments
Open

module 'inspect' has no attribute 'getargspec' #377

Timoses opened this issue Jun 30, 2023 · 3 comments

Comments

@Timoses
Copy link
Contributor

Timoses commented Jun 30, 2023

ERROR:castervoice.ContextManager:Error while applying plugin specific context in context 'caster_timoses.tmux'. Unable to get context for plugin caster_timoses.tmux: module 'inspect' has no attribute 'getargspec'
Traceback (most recent call last):
  File "/opt/code/voice/caster-core/castervoice/core/context.py", line 71, in load
    .get_plugin_context(self._plugin_id,
     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/code/voice/caster-core/castervoice/core/context_manager.py", line 85, in get_plugin_context
    .get_context(plugin_id, desired_state)
     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/code/voice/caster-core/castervoice/core/plugin/plugin_manager.py", line 160, in get_context
    get(plugin_id, None).get_context(desired_state)
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/code/voice/caster-timoses/caster_timoses/tmux/__init__.py", line 104, in get_context
    context = FuncContext(pane_cmd, **defaults)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/code/voice/venv3/lib/python3.11/site-packages/dragonfly/grammar/context.py", line 393, in __init__
    (args, _, varkw, defaults) = inspect.getargspec(self._function)
                                 ^^^^^^^^^^^^^^^^^^
AttributeError: module 'inspect' has no attribute 'getargspec'

According to inspect documentation (python 3.11) getargspec is legacy.

> pip list | grep dragon
dragonfly2           0.35.0
@drmfinlay
Copy link
Member

Hello @Timoses,

Thank you for bringing this problem to my attention. It looks like this is the only use of that function that wasn't patched.

This will be fixed in the next version (1.0.0). I expect to have that out sometime next month. For the moment, you can fix it manually by changing line 393 in context.py to the following:

(args, _, varkw, defaults) = inspect.getfullargspec(self._function)[0:4]

drmfinlay added a commit that referenced this issue Jun 30, 2023
Re: #377.

This class now uses the inspect module's `getfullargspec' function,
instead of the old deprecated one, on Python version 3 and above.
@Kentoseth
Copy link
Contributor

This change has not yet been pushed to PyPI which is still causing the errors specified above.

@drmfinlay
Copy link
Member

I published a release candidate version (1.0.0-rc2) with the change. I'm planning to release version 1.0.0 proper very soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants