sonyxperiadev / pygerrit

MIT License
52 stars 52 forks source link

Update examples to use argparse instead of optparse #20

Closed Andrey9kin closed 10 years ago

Andrey9kin commented 10 years ago

optparse was deprecated since 2.7 and removed in python 3

dpursehouse commented 10 years ago

Thanks. I'll review this when I get back to the office next week.

One slight concern is that argparse is not available as standard on python 2.6. Perhaps not a show-stopper though, as it's easily installable.

dpursehouse commented 10 years ago

After applying this patch, the example.py script fails with this error:

Traceback (most recent call last):
  File "./example.py", line 109, in <module>
    sys.exit(_main())
  File "./example.py", line 47, in _main
    help='port number (default: %default)')
  File "/usr/lib/python2.7/argparse.py", line 1286, in add_argument
    raise ValueError('%r is not callable' % (type_func,))
ValueError: 'int' is not callable
dpursehouse commented 10 years ago

Merged as a76db4cfc83d4cf7a52d045e4df82ec8b1e3f562

I added a commit on top to fix up the stuff mentioned in the comments.