Here is our approach to running node.js script with Python:
1) install Naked
pip install Naked
2) import Naked functions in python code
from Naked.toolshed.shell import execute_js, muterun_js
3) use "execute_js()" function to run node.js script
result = execute_js('testscript.js')
4) "execute_js()" function returns a boolean value. Here is how you can handle the result:
if result:
# JavaScript is successfully executed
else:
# JavaScript is failed