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

Wrap python2.7 error message with user-friendly error message #362

Closed
rnjudge opened this issue Jul 22, 2019 · 2 comments · Fixed by #420
Closed

Wrap python2.7 error message with user-friendly error message #362

rnjudge opened this issue Jul 22, 2019 · 2 comments · Fixed by #420
Labels
grokability Make the project easier to approach and understand intermediate Intermediate level issue
Milestone

Comments

@rnjudge
Copy link
Contributor

rnjudge commented Jul 22, 2019

Describe the Feature
If you run Tern in an environment that defaults to Python2.7 (even with python3 installed) you get the following output:

Traceback (most recent call last):
  File "/usr/local/bin/tern", line 11, in <module>
    sys.exit(main())
  File "/usr/local/lib/python2.7/site-packages/tern/__main__.py", line 128, in main
    do_main(args)
  File "/usr/local/lib/python2.7/site-packages/tern/__main__.py", line 73, in do_main
    report.execute_docker_image(args)
  File "/usr/local/lib/python2.7/site-packages/tern/report/report.py", line 438, in execute_docker_image
    full_image = load_full_image(args.docker_image)
  File "/usr/local/lib/python2.7/site-packages/tern/report/report.py", line 140, in load_full_image
    test_image = DockerImage(image_tag_string)
  File "/usr/local/lib/python2.7/site-packages/tern/classes/docker_image.py", line 30, in __init__
    super().__init__(image_id)
TypeError: super() takes at least 1 argument (0 given)

I propose wrapping the raw output with a more user-friendly error message. Something to the effect of "Error running Tern. Please check that python3 is configured as default."

Use Cases
This would be helpful to new users who do think they have python3 installed on their system but do not have it configured as default.

Implementation Changes
The error is being hit in tern/classes/docker_image.py. Might consider using the traceback library: https://docs.python.org/3/library/traceback.html

Another option would be for Tern to check for dependencies somehow before running.

@rnjudge rnjudge added grokability Make the project easier to approach and understand intermediate Intermediate level issue labels Jul 23, 2019
@AyahRamahi
Copy link

I am a beginner, but I would like to work on this issue, can I?

@rnjudge
Copy link
Contributor Author

rnjudge commented Aug 5, 2019

@AyahRamahi Go for it! We always love help. Let us know if you have any questions.

@nishakm nishakm added this to the Near Future milestone Aug 12, 2019
PrajwalM2212 added a commit to PrajwalM2212/tern that referenced this issue Aug 28, 2019
This PR Wraps python2.7 error message with user-friendly error message

Resolves tern-tools#362

Signed-off-by: Prajwal M <[email protected]
PrajwalM2212 added a commit to PrajwalM2212/tern that referenced this issue Aug 28, 2019
Wraps python2.7 error message with user-friendly error message

Resolves tern-tools#362

Signed-off-by: Prajwal M <[email protected]>
nishakm pushed a commit that referenced this issue Aug 28, 2019
Wraps python2.7 error message with user-friendly error message

Resolves #362

Signed-off-by: Prajwal M <[email protected]>
rnjudge pushed a commit that referenced this issue Aug 28, 2019
Wraps python2.7 error message with user-friendly error message

Resolves #362

Signed-off-by: Prajwal M <[email protected]>
rnjudge pushed a commit to rnjudge/tern that referenced this issue Jun 5, 2020
Wraps python2.7 error message with user-friendly error message

Resolves tern-tools#362

Signed-off-by: Prajwal M <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
grokability Make the project easier to approach and understand intermediate Intermediate level issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants