You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@beam.apache.org by "Jeff Webb (Jira)" <ji...@apache.org> on 2021/09/14 23:02:00 UTC
[jira] [Updated] (BEAM-10041) Can't use action with
add_value_provider_argument()
[ https://issues.apache.org/jira/browse/BEAM-10041?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Jeff Webb updated BEAM-10041:
-----------------------------
Resolution: Won't Fix
Status: Resolved (was: Triage Needed)
old issue - resolving
> Can't use action with add_value_provider_argument()
> ---------------------------------------------------
>
> Key: BEAM-10041
> URL: https://issues.apache.org/jira/browse/BEAM-10041
> Project: Beam
> Issue Type: Bug
> Components: sdk-py-core
> Affects Versions: 2.20.0
> Environment: Apache Beam 2.20.0 (the GCP variant).
> Python 3.6.9
> Ubuntu 18.04
> Reporter: Daniel Gomes
> Priority: P3
>
> The following code:
> {code:java}
> from __future__ import absolute_import
> from apache_beam.options.pipeline_options import PipelineOptions
> class UserOptions(PipelineOptions):
> @classmethod
> def _add_argparse_args(cls, _parser):
> _parser.add_value_provider_argument('--debug', action='store_true')
> if __name__ == '__main__':
> pipeline_options = PipelineOptions(streaming=True, save_main_session=True)
> user_options = pipeline_options.view_as(UserOptions)
> {code}
> Fails with:
> {noformat}
> Traceback (most recent call last):
> File "options.py", line 13, in <module>
> user_options = pipeline_options.view_as(UserOptions)
> File "/home/.../.virtualenvs/data-flow/lib/python3.6/site-packages/apache_beam/options/pipeline_options.py", line 335, in view_as
> view = cls(self._flags)
> File "/home/.../.virtualenvs/data-flow/lib/python3.6/site-packages/apache_beam/options/pipeline_options.py", line 205, in __init__
> cls._add_argparse_args(parser) # type: ignore
> File "options.py", line 8, in _add_argparse_args
> _parser.add_value_provider_argument('--debug', action='store_true')
> File "/home/.../.virtualenvs/data-flow/lib/python3.6/site-packages/apache_beam/options/pipeline_options.py", line 125, in add_value_provider_argument
> self.add_argument(*args, **kwargs)
> File "/usr/lib/python3.6/argparse.py", line 1347, in add_argument
> action = action_class(**kwargs)
> TypeError: __init__() got an unexpected keyword argument 'type'
> {noformat}
> Removing the `action` positional argument from the `add_value_provider_argument()` call gets rid of the error.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)