Skip to content

The error object doesn't have Error & traceback properties. #309

Open

Description

@varun-liftoff

Bug
I am trying to display a proper error message but the whole traceback is being printed

Python code
raise Exception("Error sample")

Javascript code

const messages = await PythonShell.run("script.py", options);
console.log("File Validated Successfully");
console.log(`Results - ${messages}`);

Expected behavior
Exception: Error Sample

Actual behavior
Whole traceback is printed. When I checked the error object in Javascript, it looks like this -

{
  executable: 'python3',
  options: [ '-u' ],
  script: 'script.py',
  args: [],
  exitCode: 1,
  logs: []
}

Other Information

  • OS: [Sonoma 14.6.1]
  • Python Version [3.9.8]
  • Node Version [22.4.1]

Activity

  1. alceops commented on Apr 28, 2026

    @alceops

    I opened a focused fix for this here: #323

    It updates traceback parsing when stderr contains prefix log lines before the traceback header and includes a regression test for the reported shape.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions