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

TypeError: 'bool' object is not callable on import on python 3.7 without typing_extensions #178

Closed
otaj opened this issue Oct 20, 2022 · 4 comments
Labels
bug Something isn't working

Comments

@otaj
Copy link

otaj commented Oct 20, 2022

🐛 Bug report

When running on python<3.8, where there is not typing.final without typing_extensions installed, importing jsonargparse produces the TypeError.

   File ".actions/assistant.py", line 17, in <module>
    import jsonargparse
  File "/opt/hostedtoolcache/Python/3.7.14/x64/lib/python3.7/site-packages/jsonargparse/__init__.py", line 9, in <module>
    from .actions import *
  File "/opt/hostedtoolcache/Python/3.7.14/x64/lib/python3.7/site-packages/jsonargparse/actions.py", line 12, in <module>
    from .loaders_dumpers import get_loader_exceptions, load_value
  File "/opt/hostedtoolcache/Python/3.7.14/x64/lib/python3.7/site-packages/jsonargparse/loaders_dumpers.py", line 10, in <module>
    from .optionals import import_jsonnet, omegaconf_support
  File "/opt/hostedtoolcache/Python/3.7.14/x64/lib/python3.7/site-packages/jsonargparse/optionals.py", line 45, in <module>
    if not getattr(final(Namespace()), '__final__', False):

The problem is in the line above (44 in optionals.py), where fallback import returns False, which is definitely not callable.

To reproduce

install jsonargparse on python 3.7 without any extras and import

Expected behavior

No TypeError

Environment

  • jsonargparse version (e.g., 4.8.0): latest at the moment of writing (4.15.2)
  • Python version (e.g., 3.9): 3.7
  • How jsonargparse was installed (e.g. pip install jsonargparse[all]): pip install jsonargparse
  • OS (e.g., Linux): Any
@otaj otaj added the bug Something isn't working label Oct 20, 2022
otaj pushed a commit to Lightning-AI/pytorch-lightning that referenced this issue Oct 20, 2022
@mauvilsa
Copy link
Member

This is fixed in commit bdc528b.

@otaj
Copy link
Author

otaj commented Oct 21, 2022

Awesome, thanks!

@otaj otaj closed this as completed Oct 21, 2022
@carmocca
Copy link
Contributor

@otaj we should revert Lightning-AI/pytorch-lightning@bbf34fc now

@otaj
Copy link
Author

otaj commented Oct 24, 2022

@carmocca I don't think we should, since this is still not available on PyPI yet. Once it will become available, we can revert it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants