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

Adjust execution of server code to generate better error messages #109

Merged
merged 2 commits into from
Jul 25, 2024

Conversation

Bluesy1
Copy link
Collaborator

@Bluesy1 Bluesy1 commented Jul 16, 2024

Before (Non SyntaxError):

$ checkq ../instructor_stats_bank/source/unsorted/openstax_C2_Q12_to_Q17/openstax_C2_Q12_to_Q17.md
Processing question: ../instructor_stats_bank/source/unsorted/openstax_C2_Q12_to_Q17/openstax_C2_Q12_to_Q17.md
There is an error in this problem: 
        - File path: ../instructor_stats_bank/source/unsorted/openstax_C2_Q12_to_Q17/openstax_C2_Q12_to_Q17.md
        - Error: can only concatenate str (not "list") to str
Traceback (most recent call last):
  File "/home/gavin/OPB/problem_bank_scripts/.venv/bin/checkq", line 6, in <module>
    sys.exit(main())
             ^^^^^^
  File "/home/gavin/OPB/problem_bank_scripts/src/problem_bank_scripts/scripts/check_question.py", line 51, in main
    raise e
  File "/home/gavin/OPB/problem_bank_scripts/src/problem_bank_scripts/scripts/check_question.py", line 42, in main
    process_question_pl(question.as_posix(), output_path=output_dir)
  File "/home/gavin/OPB/problem_bank_scripts/src/problem_bank_scripts/problem_bank_scripts.py", line 1367, in process_question_pl
    server.generate(data2)
  File "<string>", line 40, in generate
TypeError: can only concatenate str (not "list") to str

After (Non SyntaxError):

$ checkq ../instructor_stats_bank/source/unsorted/openstax_C2_Q12_to_Q17/openstax_C2_Q12_to_Q17.md
Processing question: ../instructor_stats_bank/source/unsorted/openstax_C2_Q12_to_Q17/openstax_C2_Q12_to_Q17.md
There is an error in this problem: 
        - File path: ../instructor_stats_bank/source/unsorted/openstax_C2_Q12_to_Q17/openstax_C2_Q12_to_Q17.md
        - Error: Error in running the server code, please review the below traceback: 

Traceback (most recent call last):
  File "/home/gavin/OPB/problem_bank_scripts/src/problem_bank_scripts/problem_bank_scripts.py", line 1378, in process_question_pl
    server["generate"](data2)
  File "/tmp/tmpuup_d_w2_openstax_C2_Q12_to_Q17/server.py", line 40, in generate
    table = "test" + [
            ^^^^^^^^^^
TypeError: can only concatenate str (not "list") to str

Before (SyntaxError):

$ checkq ../instructor_stats_bank/source/unsorted/openstax_C2_Q12_to_Q17/openstax_C2_Q12_to_Q17.md
Processing question: ../instructor_stats_bank/source/unsorted/openstax_C2_Q12_to_Q17/openstax_C2_Q12_to_Q17.md
There is an error in this problem: 
        - File path: ../instructor_stats_bank/source/unsorted/openstax_C2_Q12_to_Q17/openstax_C2_Q12_to_Q17.md
        - Error: invalid syntax (<string>, line 40)
Traceback (most recent call last):
  File "/home/gavin/OPB/problem_bank_scripts/.venv/bin/checkq", line 6, in <module>
    sys.exit(main())
             ^^^^^^
  File "/home/gavin/OPB/problem_bank_scripts/src/problem_bank_scripts/scripts/check_question.py", line 51, in main
    raise e
  File "/home/gavin/OPB/problem_bank_scripts/src/problem_bank_scripts/scripts/check_question.py", line 42, in main
    process_question_pl(question.as_posix(), output_path=output_dir)
  File "/home/gavin/OPB/problem_bank_scripts/src/problem_bank_scripts/problem_bank_scripts.py", line 1363, in process_question_pl
    exec(server_py, server.__dict__)
  File "<string>", line 40
    table === [
            ^
SyntaxError: invalid syntax

After (SyntaxError):

$ checkq ../instructor_stats_bank/source/unsorted/openstax_C2_Q12_to_Q17/openstax_C2_Q12_to_Q17.md
Processing question: ../instructor_stats_bank/source/unsorted/openstax_C2_Q12_to_Q17/openstax_C2_Q12_to_Q17.md
There is an error in this problem: 
        - File path: ../instructor_stats_bank/source/unsorted/openstax_C2_Q12_to_Q17/openstax_C2_Q12_to_Q17.md
        - Error: Error in running the server code, please review the below traceback: 

Traceback (most recent call last):
  File "/home/gavin/OPB/problem_bank_scripts/src/problem_bank_scripts/problem_bank_scripts.py", line 1376, in process_question_pl
    code = compile(server_py, file.as_posix(), "exec")
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/tmp/tmppkx22blx_openstax_C2_Q12_to_Q17/server.py", line 40
    table === [
            ^
SyntaxError: invalid syntax

Bluesy1 added 2 commits July 15, 2024 20:08

Verified

This commit was signed with the committer’s verified signature.
Bluesy1 Gavin Kendal-Freedman
…how up in the traceback.

Verified

This commit was signed with the committer’s verified signature.
Bluesy1 Gavin Kendal-Freedman
@Bluesy1 Bluesy1 marked this pull request as ready for review July 18, 2024 23:23
@Bluesy1 Bluesy1 changed the title Adjust execution of server code to allow the line thats erroring to s… Adjust execution of server code to generate better error messages Jul 18, 2024
@Bluesy1 Bluesy1 merged commit 49bd9bc into main Jul 25, 2024
14 of 15 checks passed
@Bluesy1 Bluesy1 deleted the better-syntax-errors branch July 25, 2024 18:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant