import { PythonShell } from 'python-shell'; const scriptFile = './app/api/BHEseppy_query_V50_MWP_beta6.py'; export async function runPythonShell(options) { try { const results = await PythonShell.run(scriptFile, options); let resultList = []; if (results && results.length > 0) { let resultString = results[results.length - 1]; resultList = resultString .replace(/[\[\]]/g, '') .split(',') .map((entry) => entry.trim().replaceAll("'", '')); } return resultList; } catch (e) { console.error(e); } }