[issue36561] Python argparse doesn't work in the presence of my custom module

2019-04-08 Thread Peter Otten
Peter Otten <__pete...@web.de> added the comment: That's a bug in your code. You create another ArgumentParser in the toplevel code of preprocess.py. When this module is imported directly or indirectly your script will us this parser to parse the command line first. Minimal example: $ cat pre

[issue36561] Python argparse doesn't work in the presence of my custom module

2019-04-08 Thread Karthikeyan Singaravelan
Karthikeyan Singaravelan added the comment: test.py shown in msg339649 accepts only --data_type DATA_TYPE. Running test.py without import and the non-existent flag would show all the options present like the below I am using from the repo you have shared. You might ./python.exe ../backups/b

[issue36561] Python argparse doesn't work in the presence of my custom module

2019-04-08 Thread JP Zhang
JP Zhang added the comment: >>>python test.py --num_epochs 200 usage: test.py [-h] [--data_type DATA_TYPE] test.py: error: unrecognized arguments: --num_epochs 200 I have a created a colab share link. You can check: https://colab.research.google.com/drive/1TUvt4CCv2d43GD1ccmuRNBJlkbUPXN8Z --

[issue36561] Python argparse doesn't work in the presence of my custom module

2019-04-08 Thread Karthikeyan Singaravelan
Karthikeyan Singaravelan added the comment: Can you please post the traceback you are getting and how you are running the script from command line? The custom module has third party dependencies like numpy so it will be helpful if you can attach a reproducer without dependencies to see if it

[issue36561] Python argparse doesn't work in the presence of my custom module

2019-04-08 Thread JP Zhang
New submission from JP Zhang : Github repo for reproducing: https://github.com/zjplab/gc-mc-pytorch/tree/bug, test.py. In the presence of my custom data_loader, it will error as unrecognized argument. But without importing it(comment it out) everything is just fine. -- components: L