python-shell icon indicating copy to clipboard operation
python-shell copied to clipboard

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

Open varun-liftoff opened this issue 1 year ago • 0 comments

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]

varun-liftoff avatar Aug 22 '24 07:08 varun-liftoff