* Runs the inputted string of python code and returns collected messages as a promise. DO NOT ALLOW UNTRUSTED USER INPUT HERE! * @param code The python code to execute * @param options The execution options * @return a promise with the output from the python script
(code: string, options?: Options)
| 340 | * @return a promise with the output from the python script |
| 341 | */ |
| 342 | static runString(code: string, options?: Options) { |
| 343 | |
| 344 | // put code in temp file |
| 345 | const randomInt = getRandomInt(); |
| 346 | const filePath = tmpdir + sep + `pythonShellFile${randomInt}.py` |
| 347 | writeFileSync(filePath, code); |
| 348 | |
| 349 | return PythonShell.run(filePath, options); |
| 350 | }; |
| 351 | |
| 352 | static getVersion(pythonPath?: string) { |
| 353 | if (!pythonPath) pythonPath = this.getPythonPath() |
no test coverage detected