want to show list of available options and arguments in my command line utility

Santosh Kumar sntshkmr60 at gmail.com
Sun Sep 16 02:50:08 EDT 2012


I have a script that takes an which basically takes a command line
argument and prints after processing. If I don't give the argument to
the script, it gives me a ValueError:

ValueError: need more than 1 value to unpack

I was trying to utilizing this space, if there is no argument I want it
to show:
usages: myscriptpy [option] [argument]

options:
--help      print this help message and exit

Nothing more than that. I was looking on the argparse module, it can
do the stuffs I want, but
I don't to rewrite and mess up my current script. What should I do?



More information about the Python-list mailing list