This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author brmzkw
Recipients brmzkw
Date 2012-09-12.09:00:35
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1347440457.56.0.780058714044.issue15929@psf.upfronthosting.co.za>
In-reply-to
Content
argparse.add_argument replaces dashes with underscores. If an argument contains another non alphanum character, accessing to it will result to a syntax error.

#! /usr/bin/env python

import argparse

if __name__ == '__main__':
    argParser = argparse.ArgumentParser()
    argParser.add_argument('--foo+', action='store_true')
    arguments = argParser.parse_args()

    print 'getattr foo+: %s' % getattr(arguments, 'foo+') # ok
    print arguments.foo+ # syntax error

The patch replaces every non alnum character with an underscore.
History
Date User Action Args
2012-09-12 09:00:57brmzkwsetrecipients: + brmzkw
2012-09-12 09:00:57brmzkwsetmessageid: <1347440457.56.0.780058714044.issue15929@psf.upfronthosting.co.za>
2012-09-12 09:00:36brmzkwlinkissue15929 messages
2012-09-12 09:00:36brmzkwcreate