Nodejs PythonShell, How To Export Variables In Run Function
I want to export variable named completed so that I can use this out of PythonShell.run function. Is there any suggestion? here's my code. python code #test.py import sys def hell
Solution 1:
Try using JSPyBridge/pythonia to call the Python script:
Through ES6 imports:
import { python } from 'pythonia'
const test = await python("./test.py")
await test.hello(2, 3)
python.exit()
Or through CommonJS imports:
const { python } = require('pythonia')
async function main() {
const test = await python("./test.py")
await test.hello(2, 3)
}
main().then(() => python.exit())
Post a Comment for "Nodejs PythonShell, How To Export Variables In Run Function"