opensafely-core / opensafely-core/opensafely-cli
Get a traceback when running `opensafely` in a deleted directory on Linux
Open
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 2
- Forks
- 5
- Avg merge
- 2d 1h
- Merged PRs (30d)
- 4
Description
Reproduce:
- Enter a directory in your terminal.
- Delete that directory.
- In the same terminal as 1, run
opensafely --version
Traceback (most recent call last):
File "…bin/opensafely", line 8, in <module>
sys.exit(main())
^^^^^^
File "…opensafely/__init__.py", line 90, in main
add_subcommand("jupyter", jupyter)
File "…opensafely/__init__.py", line 83, in add_subcommand
module.add_arguments(subparser)
File "…opensafely/jupyter.py", line 38, in add_arguments
default=os.getcwd(),
^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory
This could be a nicer error.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with opensafely/init.py and opensafely/jupyter.py, especially the add_arguments call and the os.getcwd() default shown in the traceback. Reproduce the command from a deleted directory, then verify that opensafely --version no longer emits a traceback and instead gives a user-facing result.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100