user3316792 user3316792 - 1 year ago 88
Python Question

start node app from python script

Is it possible to start a node.js app from within a python script on a raspberry pi?

On the command line I run

sudo node myscript.js

could I use a library like os?

Answer Source

The first line of file shall be:


You can call command with

from subprocess import call

# Note that you have to specify path to script
call(["node", "path_to_script.js"]) 

Then you have to set +x permissions for file to be executable:

chmod +x

Know you are ready to go:


Note: checkout Raspberry Pi Stack Exchange, you can find a lot of use full info there.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download