[ python-Bugs-850964 ] optparse: OptionParser.__init__'s "prog" argument ignored

SourceForge.net noreply at sourceforge.net
Thu Apr 1 02:54:28 EST 2004


Bugs item #850964, was opened at 2003-11-28 18:48
Message generated for change (Comment added) made by fdrake
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=850964&group_id=5470

Category: Python Library
Group: Python 2.3
>Status: Closed
>Resolution: Fixed
Priority: 5
Submitted By: Paul Mueller (yuurei)
>Assigned to: Fred L. Drake, Jr. (fdrake)
Summary: optparse: OptionParser.__init__'s "prog" argument ignored

Initial Comment:
optparse uses sys.argv[0] for the program name even if
you supply the   
prog argument to OptionParser.__init__

ie, if you have p = OptionParser(prog='NEW_NAME'),
p.print_usage, p.print_help, p.error, etc. don't use
NEW_NAME as %prog.

This is with Python 2.3.2

----------------------------------------------------------------------

>Comment By: Fred L. Drake, Jr. (fdrake)
Date: 2004-04-01 02:54

Message:
Logged In: YES 
user_id=3066

Unfortunately, the patch breaks some of the existing tests
for optparse.  I've committed a fix that doesn't require
changing the existing tests and that adds new tests so this
doesn't break in the future.

Fixed for Python 2.3.4 and 2.4:

Lib/optparse.py  1.8, 1.5.8.2
Lib/test/test_optparse.py  1.3, 1.2.8.2


----------------------------------------------------------------------

Comment By: Paul Mueller (yuurei)
Date: 2003-12-01 12:33

Message:
Logged In: YES 
user_id=908814

The patch works perfectly.

Thank you.

----------------------------------------------------------------------

Comment By: George Yoshida (quiver)
Date: 2003-12-01 01:06

Message:
Logged In: YES 
user_id=671362

I've submitted a patch.
See : http://www.python.org/sf/851902

Please apply the patch and check if "prog" argument 
works.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=850964&group_id=5470



More information about the Python-bugs-list mailing list