Skip to content

Avoid changing the host process arguments when importing the CLI - #1430

Open
justavibedev wants to merge 1 commit into
jsvine:developfrom
justavibedev:fix/cli-import-arguments
Open

justavibedev wants to merge 1 commit into
jsvine:developfrom
justavibedev:fix/cli-import-arguments

Conversation

@justavibedev

Copy link
Copy Markdown

Importing pdfplumber.cli in a Python process with no command-line arguments adds --help to the host program's sys.argv. If the host parses its own arguments afterward, it can print help and exit before doing any work.

This moves the no-argument help behavior into main() and reads the arguments at call time. The regression test imports the CLI in a fresh Python process. It failed on develop; all 17 tests in tests/test_convert.py passed after the fix, including the existing no-argument help test.

Codex assisted with the implementation and offline testing.

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