Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Argparse regression #34

Open
nakker opened this issue Nov 4, 2023 · 1 comment
Open

Argparse regression #34

nakker opened this issue Nov 4, 2023 · 1 comment

Comments

@nakker
Copy link

nakker commented Nov 4, 2023

If the --center argument starts with a negative number argparse fails (see https://bugs.python.org/issue9334)

$ python sample_for_pdb.py --pdb_path ./example/6j00.pdb --center '-42.6,-30.6,-11.6'
usage: sample_for_pdb.py [-h] [--pdb_path PDB_PATH] [--center CENTER] [--bbox_size BBOX_SIZE] [--config CONFIG] [--device DEVICE] [--outdir OUTDIR]
sample_for_pdb.py: error: argument --center: expected one argument

A simple workaround is to place a space as the first character in the --center argument such as

$ python sample_for_pdb.py --pdb_path ./example/6j00.pdb --center ' -42.6,-30.6,-11.6'

Without solving the regression, a horribly hacky way to fix this would be on line 67 of sample_for_pdb.py

if __name__ == '__main__':
    idx = sys.argv.index("--center")+1
    sys.argv[idx] = ' ' + sys.argv[idx]
    parser = argparse.ArgumentParser()
    ...
@pengxingang
Copy link
Owner

Thank you very much for your valuable suggestion. We took note of the situation in which the center parameter begins with a negative value and had left a space before the first value in the example in our readme.md file. To ensure this space is not overlooked, we may need to place greater emphasis on it. Once again, we sincerely appreciate your feedback.

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

No branches or pull requests

2 participants