Skip to content

fix: print why the Python frontend failed - #61

Merged
ylluminate merged 1 commit into
vlang:masterfrom
ylluminate:fix-frontend-errors
Nov 13, 2026
Merged

ylluminate merged 1 commit into
vlang:masterfrom
ylluminate:fix-frontend-errors

Conversation

@ylluminate

Copy link
Copy Markdown
Contributor

py2v file.py printed nothing and exited 1 when the Python frontend failed, for example on a file with a syntax error or a path that doesn't exist. The frontend does print a message, but os.exec_opt returns an error when the command exits non-zero, and main handled that with or { exit(1) }, so the block right below it that prints the output was never reached.

Now the error is printed:

$ py2v missing.py
Error running Python frontend:
Error: File 'missing.py' does not exist.

and a syntax error prints SyntaxError in 'bad.py': invalid syntax (bad.py, line 1) the same way. --package already reported a syntax error in a file it translates.

Fixes #5. That issue is only a title, "Add error handling", and this silent exit is what I found missing when I went through py2v's failure paths for it.

Test plan

  • Two new checks in tests/run_tests.vsh, a file with a syntax error and a file that doesn't exist: both fail with master's py2v and pass with this change.
  • v tests/run_tests.vsh: 174 passed, 0 failed (172 before, plus the two checks).

@ylluminate
ylluminate merged commit 826685b into vlang:master Nov 13, 2026
2 checks passed
@ylluminate
ylluminate deleted the fix-frontend-errors branch November 13, 2026 08:28
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.

Add error handling

1 participant