Skip to content

fix: import pathlib in rleapp.py so --custom_artifacts_path works - #381

Merged
abrignoni merged 1 commit into
mainfrom
fix/rleapp-missing-pathlib-import
Jul 26, 2026
Merged

fix: import pathlib in rleapp.py so --custom_artifacts_path works#381
abrignoni merged 1 commit into
mainfrom
fix/rleapp-missing-pathlib-import

Conversation

@abrignoni

Copy link
Copy Markdown
Owner

main() calls pathlib.Path(args.custom_artifacts_path) at line 195, but pathlib is never imported, and it is not re-exported by any of the three wildcard imports at the top of the file (checked each one). Passing the flag aborts before anything happens.

Reproduced against main

$ python3 rleapp.py --custom_artifacts_path /tmp/somedir -p
Traceback (most recent call last):
  File "rleapp.py", line 498, in <module>
    main()
  File "rleapp.py", line 195, in main
    loader_paths.append(pathlib.Path(args.custom_artifacts_path))
                        ^^^^^^^
NameError: name 'pathlib' is not defined. Did you mean: 'hashlib'?

The flag has presumably never worked. Line 195 sits immediately after parse_args() with no early exit before it, so the crash is unconditional whenever the option is supplied.

After

Same command completes normally, loading the extra path:

*[Dd][Vv] [Aa]ccess [Ll]ogs*.csv
*contacts_*.txt

Artifact path list generation completed

Why it went unnoticed

pylint has been reporting it on every run:

rleapp.py:195:28: E0602: Undefined variable 'pathlib'

but the repo had no lint workflow until #380, so nothing surfaced it. Worth noting that the diff-aware check added there would not catch this either — it fails only on warnings a change introduces, and this one predates any change. It showed up because I was measuring the pre-existing baseline while writing that workflow.

rleapp.py goes from 14 pre-existing warnings to 13; the new lint gate reports No new warnings introduced (1 fewer than before). PASS.

🤖 Generated with Claude Code

main() calls pathlib.Path(args.custom_artifacts_path) at line 195, but
pathlib was never imported and is not re-exported by any of the three
wildcard imports at the top of the file. Passing the flag therefore aborted
before doing anything:

    File "rleapp.py", line 195, in main
        loader_paths.append(pathlib.Path(args.custom_artifacts_path))
    NameError: name 'pathlib' is not defined

Reproduced against main with `rleapp.py --custom_artifacts_path <dir> -p`,
and confirmed fixed by the same command, which now loads the extra path and
finishes normally.

pylint had been reporting this as E0602 on every run; it went unnoticed
because the repo had no lint workflow until now. The diff-aware check added
in #380 would not have caught it either, since it predates the change it
measures against.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@abrignoni
abrignoni merged commit aaf183a into main Jul 26, 2026
1 check passed
@abrignoni
abrignoni deleted the fix/rleapp-missing-pathlib-import branch July 26, 2026 01:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant