Getting an "ImportError: cannot import name 'ArgSpec' from 'inspect'" Error
GeorgAubele opened this issue · 5 comments
Things to check first
- I have searched the existing issues and didn't find my feature already requested there
Feature description
Can't use sqlacodegen, because I'm getting this error everytime I start it, even with
sqlacodegen --help
Error Messages as folllows:
Traceback (most recent call last):
File "", line 198, in _run_module_as_main
File "", line 88, in run_code
File "E:\Programme\Python\Scripts\sqlacodegen.exe_main.py", line 4, in
File "E:\Programme\Python\Lib\site-packages\sqlacodegen\main.py", line 11, in
from sqlacodegen.codegen import CodeGenerator
File "E:\Programme\Python\Lib\site-packages\sqlacodegen\codegen.py", line 9, in
from inspect import ArgSpec
ImportError: cannot import name 'ArgSpec' from 'inspect' (E:\Programme\Python\Lib\inspect.py)
Use case
I want to use sqlacodegen and don't know how to file a bug report.
ArgSpec
has been removed from Python 3.11. You have two solutions:
- Downgrade your Python version to 3.10.
- Use my forked version of
sqlacodegen
with simple fix. Just replacesqlacodegen
in yourrequirements.txt
bygit+https://github.com/bobzomer/sqlacodegen@Maintenance_V2#egg=sqlacodegen
.
@agronholm I see that you began a big refactoring towards a 3.0 version. In the meantime, would you be open to create a maintenance branch and release a 2.3.1 based on my fork and branch?
Solution number 3: use the 3.0 release candidate which contains the fix.
@agronholm Can we close this issue? It seems like an exact dupe of #239, for which there's a clear/simple solution (to which you referred herein, using the release candidate 3.0).
Yup.