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

unimport with no options and no config file produces an error #281

Closed
Tracked by #271
mxr opened this issue Feb 3, 2023 · 0 comments · Fixed by #282
Closed
Tracked by #271

unimport with no options and no config file produces an error #281

mxr opened this issue Feb 3, 2023 · 0 comments · Fixed by #282
Assignees
Labels
bug Something isn't working changelog Changes should be written to the changelog file. test
Milestone

Comments

@mxr
Copy link
Contributor

mxr commented Feb 3, 2023

See below output:

$ unimport example.py
Traceback (most recent call last):
  File "/Users/mxr/tmp/venv3.7/bin/unimport", line 8, in <module>
    sys.exit(main())
  File "/Users/mxr/tmp/venv3.7/lib/python3.7/site-packages/unimport/__main__.py", line 6, in main
    main = Main.run()
  File "/Users/mxr/tmp/venv3.7/lib/python3.7/site-packages/unimport/main.py", line 107, in run
    self = cls(argv)
  File "<string>", line 4, in __init__
  File "/Users/mxr/tmp/venv3.7/lib/python3.7/site-packages/unimport/main.py", line 39, in __post_init__
    self.config = self.argv_to_config()
  File "/Users/mxr/tmp/venv3.7/lib/python3.7/site-packages/unimport/main.py", line 47, in argv_to_config
    commands.generate_parser().parse_args(self.argv if self.argv is not None else sys.argv[1:])
  File "/Users/mxr/tmp/venv3.7/lib/python3.7/site-packages/unimport/config.py", line 194, in parse_args
    config_context = cls(Path(path)).parse()
  File "<string>", line 4, in __init__
  File "/Users/mxr/tmp/venv3.7/lib/python3.7/site-packages/unimport/config.py", line 127, in __post_init__
    raise FileNotFoundError(f"Config file not found: {self.config_file}")
FileNotFoundError: Config file not found: setup.cfg

Perhaps unimport could have some default useful/silent behavior in the presence of no options and no config?

@hakancelikdev hakancelikdev mentioned this issue Feb 4, 2023
9 tasks
@hakancelikdev hakancelikdev linked a pull request Feb 4, 2023 that will close this issue
@hakancelikdev hakancelikdev added this to the 1.0.0 milestone Feb 4, 2023
@hakancelikdev hakancelikdev added bug Something isn't working changelog Changes should be written to the changelog file. test labels Feb 4, 2023
@hakancelikdev hakancelikdev self-assigned this Feb 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working changelog Changes should be written to the changelog file. test
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants