opensafely-core / opensafely-core/opensafely-cli

Get a traceback when running `opensafely` in a deleted directory on Linux

Open
#221 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
2
Forks
5
Avg merge
2d 1h
Merged PRs (30d)
4

Description

Reproduce:

  1. Enter a directory in your terminal.
  2. Delete that directory.
  3. 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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.