Skip to content

test や submit の --dir に相対パスを指定すると実行ファイルの実行に失敗する #239

@ymduu

Description

@ymduu

表題の通り、 2.4.0 以降のバージョンで test や submit の --dir に相対パスを指定すると FileNotFoundError になります。
https://github.com/kyuridenamida/atcoder-tools/blob/stable/atcodertools/executils/run_program.py#L38
run_program に相対パスが渡ってきている かつ、 subprocess.run の引数 cwd が指定されているため、実行ファイルを cwd からの相対パスで探そうとしてそのパスに実行ファイルがないため失敗している様子です。

Python のドキュメント によると、

If cwd is not None, the function changes the working directory to cwd before executing the child. cwd can be a string, bytes or path-like object. In particular, the function looks for executable (or for the first item in args) relative to cwd if the executable path is a relative path.

とのことです。
実行ファイルのパスを cwd からの相対パスにしたいことはあまりない気がしますので、 run_program に渡る前に相対パスを解決する層を追加するのが良さそうでしょうか……(あまり全体を追えてないですが)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions