Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

optparse doex not export make_option #49440

Closed
bluebird75 mannequin opened this issue Feb 9, 2009 · 2 comments
Closed

optparse doex not export make_option #49440

bluebird75 mannequin opened this issue Feb 9, 2009 · 2 comments
Assignees
Labels
docs Documentation in the Doc dir stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error

Comments

@bluebird75
Copy link
Mannequin

bluebird75 mannequin commented Feb 9, 2009

BPO 5190
Nosy @birkenfeld, @bluebird75

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = 'https://github.com/birkenfeld'
closed_at = <Date 2009-03-31.19:12:40.348>
created_at = <Date 2009-02-09.13:23:11.533>
labels = ['type-bug', 'library', 'docs']
title = 'optparse doex not export make_option'
updated_at = <Date 2009-03-31.19:12:40.347>
user = 'https://github.com/bluebird75'

bugs.python.org fields:

activity = <Date 2009-03-31.19:12:40.347>
actor = 'georg.brandl'
assignee = 'georg.brandl'
closed = True
closed_date = <Date 2009-03-31.19:12:40.348>
closer = 'georg.brandl'
components = ['Documentation', 'Library (Lib)']
creation = <Date 2009-02-09.13:23:11.533>
creator = 'bluebird'
dependencies = []
files = []
hgrepos = []
issue_num = 5190
keywords = []
message_count = 2.0
messages = ['81456', '84870']
nosy_count = 2.0
nosy_names = ['georg.brandl', 'bluebird']
pr_nums = []
priority = 'normal'
resolution = 'fixed'
stage = None
status = 'closed'
superseder = None
type = 'behavior'
url = 'https://bugs.python.org/issue5190'
versions = ['Python 2.6', 'Python 2.5']

@bluebird75
Copy link
Mannequin Author

bluebird75 mannequin commented Feb 9, 2009

The documentation of optparse mentions make_option() as the standard way
to create an option list:

For example, in the doc of python 2.5:

====
14.3.3.2 Populating the parser

[...]
pass it an Option instance (as returned by make_option())

[...]

option_list = [
    make_option("-f", "--filename",
                action="store", type="string", dest="filename"),
    make_option("-q", "--quiet",
                action="store_false", dest="verbose"),
    ]

(make_option() is a factory function for creating Option instances;
currently it is an alias for the Option constructor. A future version of
optparse may split Option into several classes, and make_option() will
pick the right class to instantiate. Do not instantiate Option
directly.)
===============

However, make_option is not part of the function exported in the __all__
list of optparse. Strangely enough, this does not prevent to use
make_option() in regular python scripts, but it does not work when
packaging a python application, for example with pyinstaller.

The problem is also present in python 2.6

The fix is either to update the documentation to use Option() directly
or to add make_option to __all__

@bluebird75 bluebird75 mannequin assigned birkenfeld Feb 9, 2009
@bluebird75 bluebird75 mannequin added docs Documentation in the Doc dir stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error labels Feb 9, 2009
@birkenfeld
Copy link
Member

As commented in optparse.py, make_option is the preferred way to create
options, so I've added it to __all__ in r70868.

@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation in the Doc dir stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

1 participant