Unable to parse Command line argument in Python
<p>I am trying to create a script that takes command line argument and based on the input, it calls out to relevant function. 
Here is how my main function looks like: </p>

<pre><code>from lib.updatefeed import gather
#stdlib imports
import argparse



def main():
    print "test"
    parser = argparse.ArgumentParser(formatter_class=argparse.RawTextHelpFormatter)
    parser.add_argument('-ip', type=str, nargs='+', help="Search for a single IP")

    parser.add_argument('-list', type=str, nargs='?', help="Search for a list of IP")
    parser.add_argument('-update', type=str, nargs='?', help='Update the local storage')
    args = parser.parse_args()
    if args.ip:
        if len(args.ip) &gt; 4:
            print "Too many"
            sys.exit(1)
        parse_ip(args.ip)
    if args.list:
        parse_ipList(list)
    if args.update:
        print "updating"
        gather()

if __name__ == '__main__':
    main()
</code></pre>

<p>All other Arguments are working fine and the respective functions are being called. The only problem is with the "update" argument. 
For some reason, the <code>gather()</code> function is not getting called when the -update arg is passed. I have also added a print statement before the function call but that is also not getting printed either.</p>

<p>Can anyone help me in identifying the root cause.</p>

<p>Here is a part of my gather function as well: </p>

<pre><code>def gather(self):
    if not os.path.exists('New'):
        os.mkdir('New')
    print "Starting feed update process"
</code></pre>