Closed Bug 1200409 Opened 6 years ago Closed 6 years ago

|marionette --help| causes stack trace: "unsupported format character 'p'"


(Testing :: Marionette, defect)

Not set


(firefox43 fixed)

Tracking Status
firefox43 --- fixed


(Reporter: erahm, Assigned: parkouss)



(Keywords: regression)


(1 file, 1 obsolete file)

When trying to print the usage for the |marionette| command I get the following stack trace:

> $ marionette --help
> Traceback (most recent call last):
>   File "/home/erahm/dev/areweslimyet/marionette-env/bin/marionette", line 9, in <module>
>     load_entry_point('marionette-client==0.19', 'console_scripts', 'marionette')()
>   File "/home/erahm/dev/areweslimyet/marionette-env/local/lib/python2.7/site-packages/marionette/", line 51, in cli
>     args = parser.parse_args()
>   File "/home/erahm/dev/areweslimyet/marionette-env/local/lib/python2.7/site-packages/marionette/runner/", line 395, in parse_args
>     args = ArgumentParser.parse_args(self, args, values)
>   File "/usr/lib/python2.7/", line 1690, in parse_args
>     args, argv = self.parse_known_args(args, namespace)
>   File "/usr/lib/python2.7/", line 1722, in parse_known_args
>     namespace, args = self._parse_known_args(args, namespace)
>   File "/usr/lib/python2.7/", line 1928, in _parse_known_args
>     start_index = consume_optional(start_index)
>   File "/usr/lib/python2.7/", line 1868, in consume_optional
>     take_action(action, args, option_string)
>   File "/usr/lib/python2.7/", line 1796, in take_action
>     action(self, namespace, argument_values, option_string)
>   File "/usr/lib/python2.7/", line 996, in __call__
>     parser.print_help()
>   File "/usr/lib/python2.7/", line 2329, in print_help
>     self._print_message(self.format_help(), file)
>   File "/usr/lib/python2.7/", line 2303, in format_help
>     return formatter.format_help()
>   File "/usr/lib/python2.7/", line 281, in format_help
>     help = self._root_section.format_help()
>   File "/usr/lib/python2.7/", line 211, in format_help
>     func(*args)
>   File "/usr/lib/python2.7/", line 298, in _format_usage
>     usage = usage % dict(prog=self._prog)
> ValueError: unsupported format character 'p' (0x70) at index 1

Version info:
> $ marionette --version
> %prog 0.19 (using marionette-driver: 0.13, marionette-transport: 0.7)
This appears to be because of the use of '%prog'. Perhaps there's a missing substitution going on?
I assume somewhat a regression from Juliens work on bug 1183157?
Flags: needinfo?(j.parkouss)
Right - not sure how I did that though. :)

Working on a fix right now.
Flags: needinfo?(j.parkouss)
Attached patch 1200294.patch (obsolete) — Splinter Review
I can confirm the bug. The attached patch fixes it for me, and now I can run with success:

 - marionette --help
 - marionette --version
Assignee: nobody → j.parkouss
Attachment #8655311 - Flags: review?(ato)
Attached patch 1200409.patchSplinter Review
Sorry I attached the wrong patch.
Attachment #8655311 - Attachment is obsolete: true
Attachment #8655311 - Flags: review?(ato)
Attachment #8655312 - Flags: review?(ato)
Comment on attachment 8655312 [details] [diff] [review]

Review of attachment 8655312 [details] [diff] [review]:

Please consider using mozreview next time.
Attachment #8655312 - Flags: review?(ato) → review+
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla43
This is not only --help but nearly everything. This makes 0.19 unusable for me. Julien, we should release a new version of marionette client.
Blocks: 1198889
Summary: |marionette --help| causes stack trace → marionette CLI causes stack trace: "unsupported format character 'p'"
So actually this bug appeared because of the underlying changes from optparse to argparse on bug 1163801. While optparse supports %prog it's not supported in argparse.

What I wonder why the Marionette unit tests were not broken due to this problem.
Not sure what exactly went wrong with my local environment but re-creating it fixes the issue for me. So this is indeed only the --help argument which is affected. Julien already raised bug 1201036 for the release, but we might want to wait until someone complains or we would have another release anyway.
Summary: marionette CLI causes stack trace: "unsupported format character 'p'" → |marionette --help| causes stack trace: "unsupported format character 'p'"
You need to log in before you can comment on or make changes to this bug.