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

pyreverse: invalid argument causes exception #7851

Closed
dgutson opened this issue Nov 25, 2022 · 4 comments
Closed

pyreverse: invalid argument causes exception #7851

dgutson opened this issue Nov 25, 2022 · 4 comments
Assignees
Labels
Crash 💥 A bug that makes pylint crash pyreverse Related to pyreverse component
Milestone

Comments

@dgutson
Copy link

dgutson commented Nov 25, 2022

Bug description

pyreverse --version
causes

Traceback (most recent call last):
  File "/home/daniel/.local/bin/pyreverse", line 8, in <module>
    sys.exit(run_pyreverse())
  File "/home/daniel/.local/lib/python3.10/site-packages/pylint/__init__.py", line 67, in run_pyreverse
    PyreverseRun(argv or sys.argv[1:])
  File "/home/daniel/.local/lib/python3.10/site-packages/pylint/pyreverse/main.py", line 229, in __init__
    sys.exit(self.run(args))
  File "/home/daniel/.local/lib/python3.10/site-packages/pylint/pyreverse/main.py", line 237, in run
    project = project_from_files(
  File "/home/daniel/.local/lib/python3.10/site-packages/pylint/pyreverse/inspector.py", line 328, in project_from_files
    fpath = astroid.modutils.file_from_modpath(something.split("."))
  File "/home/daniel/.local/lib/python3.10/site-packages/astroid/modutils.py", line 334, in file_from_modpath
    return file_info_from_modpath(modpath, path, context_file).location
  File "/home/daniel/.local/lib/python3.10/site-packages/astroid/modutils.py", line 384, in file_info_from_modpath
    return _spec_from_modpath(modpath, path, context)
  File "/home/daniel/.local/lib/python3.10/site-packages/astroid/modutils.py", line 596, in _spec_from_modpath
    found_spec = spec.find_spec(modpath, path)
  File "/home/daniel/.local/lib/python3.10/site-packages/astroid/interpreter/_import/spec.py", line 392, in find_spec
    finder, spec = _find_spec_with_path(
  File "/home/daniel/.local/lib/python3.10/site-packages/astroid/interpreter/_import/spec.py", line 361, in _find_spec_with_path
    raise ImportError(f"No module named {'.'.join(module_parts)}")
ImportError: No module named --version

BTW, please add --version ;)

CC @qequ

Configuration

No response

Command used

--version

Pylint output

Traceback (most recent call last):
  File "/home/daniel/.local/bin/pyreverse", line 8, in <module>
    sys.exit(run_pyreverse())
  File "/home/daniel/.local/lib/python3.10/site-packages/pylint/__init__.py", line 67, in run_pyreverse
    PyreverseRun(argv or sys.argv[1:])
  File "/home/daniel/.local/lib/python3.10/site-packages/pylint/pyreverse/main.py", line 229, in __init__
    sys.exit(self.run(args))
  File "/home/daniel/.local/lib/python3.10/site-packages/pylint/pyreverse/main.py", line 237, in run
    project = project_from_files(
  File "/home/daniel/.local/lib/python3.10/site-packages/pylint/pyreverse/inspector.py", line 328, in project_from_files
    fpath = astroid.modutils.file_from_modpath(something.split("."))
  File "/home/daniel/.local/lib/python3.10/site-packages/astroid/modutils.py", line 334, in file_from_modpath
    return file_info_from_modpath(modpath, path, context_file).location
  File "/home/daniel/.local/lib/python3.10/site-packages/astroid/modutils.py", line 384, in file_info_from_modpath
    return _spec_from_modpath(modpath, path, context)
  File "/home/daniel/.local/lib/python3.10/site-packages/astroid/modutils.py", line 596, in _spec_from_modpath
    found_spec = spec.find_spec(modpath, path)
  File "/home/daniel/.local/lib/python3.10/site-packages/astroid/interpreter/_import/spec.py", line 392, in find_spec
    finder, spec = _find_spec_with_path(
  File "/home/daniel/.local/lib/python3.10/site-packages/astroid/interpreter/_import/spec.py", line 361, in _find_spec_with_path
    raise ImportError(f"No module named {'.'.join(module_parts)}")
ImportError: No module named --version


### Expected behavior

`Unrecognized option --version`

### Pylint version

```shell
pylint 2.15.3
astroid 2.12.10
Python 3.10.6 (main, Nov  2 2022, 18:53:38) [GCC 11.3.0]

I can't know pyreverse version!



### OS / Environment

wsl ubuntu 22.04

### Additional dependencies

_No response_
@dgutson dgutson added the Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling label Nov 25, 2022
@mbyrnepr2 mbyrnepr2 added pyreverse Related to pyreverse component Crash 💥 A bug that makes pylint crash Needs PR This issue is accepted, sufficiently specified and now needs an implementation and removed Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling labels Nov 25, 2022
@mbyrnepr2
Copy link
Member

Thanks @dgutson I can reproduce it.

@Pierre-Sassoulas Pierre-Sassoulas removed the Needs PR This issue is accepted, sufficiently specified and now needs an implementation label Nov 25, 2022
@qequ
Copy link
Contributor

qequ commented Nov 25, 2022

@Pierre-Sassoulas please assign this to me

@dgutson
Copy link
Author

dgutson commented Aug 27, 2024

Fixed in #8257

@dgutson dgutson closed this as completed Aug 27, 2024
@Pierre-Sassoulas
Copy link
Member

Thank you for the clean up @dgutson :)

@Pierre-Sassoulas Pierre-Sassoulas added this to the 2.16.2 milestone Aug 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Crash 💥 A bug that makes pylint crash pyreverse Related to pyreverse component
Projects
None yet
Development

No branches or pull requests

4 participants