Improve the python run error message.

Review Request #1777 - Created Feb. 15, 2015 and submitted

Information
John Sirois
pants
jsirois/python_run/better_error_msg
1111
f9a4aba...
Reviewers
pants-reviews
benjyw, mateor, zundel
Previously `%` and `.format` syntaxes were mixed, this is now corrected.
Additionally the error message is improved to include the actual python
binary used to perform the run, the entry point that was run and a more
friendly list of arguments to the entry point.

 src/python/pants/backend/python/tasks/python_run.py | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

Noticed this testing https://rbcommons.com/s/twitter/r/1773/

Was:

$ PANTS_DEV=1 ./pants run src/python/pants/backend/jvm/tasks/jvm_compile:anonymize_zinc_analysis
...
10:27:28 00:00   [run]
10:27:28 00:00     [py]
10:27:28 00:00       [run]
...
  File "/home/jsirois/dev/3rdparty/pants/src/python/pants/backend/jvm/tasks/jvm_compile/scala/bin/anonymize_analysis.py", line 45, in <module>
    main()
  File "/home/jsirois/dev/3rdparty/pants/src/python/pants/backend/jvm/tasks/jvm_compile/scala/bin/anonymize_analysis.py", line 28, in main
    word_file = sys.argv[1]
IndexError: list index out of range

FAILURE: python {args} ... exited non-zero ({code})

Now is:

$ PANTS_DEV=1 ./pants run src/python/pants/backend/jvm/tasks/jvm_compile:anonymize_zinc_analysis
...
10:36:45 00:00   [run]
10:36:45 00:00     [py]
10:36:46 00:01       [run]
...
  File "/home/jsirois/dev/3rdparty/pants/src/python/pants/backend/jvm/tasks/jvm_compile/scala/bin/anonymize_analysis.py", line 45, in <module>
    main()
  File "/home/jsirois/dev/3rdparty/pants/src/python/pants/backend/jvm/tasks/jvm_compile/scala/bin/anonymize_analysis.py", line 28, in main
    word_file = sys.argv[1]
IndexError: list index out of range

FAILURE: /home/jsirois/.pyenv/versions/2.7.8/bin/python2.7 pants.backend.jvm.tasks.jvm_compile.scala.bin.anonymize_analysis  ... exited non-zero (1)

CI went green here:
https://travis-ci.org/pantsbuild/pants/builds/50852360

Benjy Weinberger
Mateo Rodriguez
John Sirois
John Sirois
Review request changed

Status: Closed (submitted)

Loading...