for argument type File, `lazy` does not work on Windows
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 17.7k
- Forks
- 2.3k
- Avg merge
- 1d 30m
- Merged PRs (30d)
- 18
Description
@click.argument(
"csv_file",
default="goodreads_library_export.csv",
type=click.File(
"r",
lazy=True,
),
nargs=1,
)
That work as expected in Linux - if I do not open the file it works even if there is no such file.
But in Windows it fails
https://github.com/andgineer/goodreads-export/actions/runs/3867907090/jobs/6593008354
`Usage: main [OPTIONS] [CSV_FILE]
Try 'main --help' for help.
Error: Invalid value for '[CSV_FILE]': 'goodreads_library_export.csv': No such file or directory`
Environment:
- Python version: 3.9
- Click version: 8.1.3
Contributor guide
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 by reproducing the Click 8.1.3 example with click.File("r", lazy=True) on Windows, then compare its argument validation with Linux behavior. Use the linked GitHub Actions run as the Windows failure reference; done means a nonexistent default path is accepted when the file is never opened, with coverage for the Windows case.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100