AttributeError: module 'inspect' has no attribute 'getargspec'. Did you mean: 'getargs'?
See original GitHub issueI’m having an issue running invoke (latest) in Python 3.11-dev (3.11.0a3). For this tasks file, this is the trace I get:
root@18bb2bd21aaa:/b2s# poetry run inv tests
Traceback (most recent call last):
File "/root/.cache/pypoetry/virtualenvs/blake2signer-uv6dtlQx-py3.11/bin/inv", line 8, in <module>
sys.exit(program.run())
^^^^^^^^^^^^^
File "/root/.cache/pypoetry/virtualenvs/blake2signer-uv6dtlQx-py3.11/lib/python3.11/site-packages/invoke/program.py", line 373, in run
self.parse_collection()
^^^^^^^^^^^^^^^^^^^^^^^
File "/root/.cache/pypoetry/virtualenvs/blake2signer-uv6dtlQx-py3.11/lib/python3.11/site-packages/invoke/program.py", line 465, in parse_collection
self.load_collection()
^^^^^^^^^^^^^^^^^^^^^^
File "/root/.cache/pypoetry/virtualenvs/blake2signer-uv6dtlQx-py3.11/lib/python3.11/site-packages/invoke/program.py", line 696, in load_collection
module, parent = loader.load(coll_name)
^^^^^^^^^^^^^^^^^^^^^^
File "/root/.cache/pypoetry/virtualenvs/blake2signer-uv6dtlQx-py3.11/lib/python3.11/site-packages/invoke/loader.py", line 76, in load
module = imp.load_module(name, fd, path, desc)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/imp.py", line 235, in load_module
return load_source(name, filename, file)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/imp.py", line 172, in load_source
module = _load(spec)
^^^^^^^^^^^
File "<frozen importlib._bootstrap>", line 721, in _load
File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 902, in exec_module
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "/b2s/tasks.py", line 11, in <module>
def flake8(ctx):
^^^^^^^^^^^^^^^^
File "/root/.cache/pypoetry/virtualenvs/blake2signer-uv6dtlQx-py3.11/lib/python3.11/site-packages/invoke/tasks.py", line 325, in task
return klass(args[0], **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/.cache/pypoetry/virtualenvs/blake2signer-uv6dtlQx-py3.11/lib/python3.11/site-packages/invoke/tasks.py", line 76, in __init__
self.positional = self.fill_implicit_positionals(positional)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/.cache/pypoetry/virtualenvs/blake2signer-uv6dtlQx-py3.11/lib/python3.11/site-packages/invoke/tasks.py", line 167, in fill_implicit_positionals
args, spec_dict = self.argspec(self.body)
^^^^^^^^^^^^^^^^^^^^^^^
File "/root/.cache/pypoetry/virtualenvs/blake2signer-uv6dtlQx-py3.11/lib/python3.11/site-packages/invoke/tasks.py", line 153, in argspec
spec = inspect.getargspec(func)
^^^^^^^^^^^^^^^^^^
AttributeError: module 'inspect' has no attribute 'getargspec'. Did you mean: 'getargs'?
It works perfectly fine for any other Python version I tried (3.7, 3.8, 3.9, 3.10, PyPy3.7, PyPy3.8, Stackless3.7, Stackless3.8).
The module inspect does indeed not have said attribute, and I see that there’s a potential replacement done in invoke.vendor.decorator for some reason.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:10
- Comments:7
Top Results From Across the Web
pyFirmata gives error: module 'inspect' has no attribute ...
Your error message is caused by a missing function inspect.getargspec() . This function is part of the Python Standard Library, but has been ......
Read more >2102058 – module 'inspect' has no attribute 'getargspec'
Description of problem: targetcli is not working on the current rawhide Version-Release number of selected component (if applicable): ...
Read more >module 'inspect' has no attribute 'getargspec' on Python 3.6 ...
AttributeError : module 'inspect' has no attribute 'getargspec' on Python 3.6 (nightly)
Read more >inspect — Inspect live objects — Python 3.11.1 documentation
Source code: Lib/inspect.py The inspect module provides several useful functions to ... that getmembers can't (like descriptors that raise AttributeError).
Read more >Tautulli won't start with Fedora 37 (Python 3.11) - Reddit
Oct 22 08:39:27 charon Tautulli.py[47389]: AttributeError: module 'inspect' has no attribute 'getargspec'. Did you mean: 'getargs'?
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Until an update is released this can be worked around temporarily with a hack to monkey patch the
inspectmodule in yourtasks.pyfile. Here is an example working for me on Python 3.11:Both PRs below would solve it, right?
https://github.com/pyinvoke/invoke/pull/458 https://github.com/pyinvoke/invoke/pull/606