Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run python script on startup #3196

Closed
ryantuck opened this issue Mar 7, 2015 · 4 comments
Closed

Run python script on startup #3196

ryantuck opened this issue Mar 7, 2015 · 4 comments
Labels

Comments

@ryantuck
Copy link

ryantuck commented Mar 7, 2015

I notice in tests/package.json, there is a field entitled scripts that calls a python script to run:

"scripts": {
    "install": "python ../tools/build_native_modules.py"
  }

Does this mean it's possible to trigger a python script to run upon startup? I ask because I'm using python to control some LEDs (can't get away from it) and want to make a nice UI utilizing nw.js to package it all up. I've been able to make a front-end and have a flask web server handling things on localhost.

Would love it if this feature existed (and if there were instructions on the wiki).

Keep up the great work!

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

@felicienfrancois
Copy link

this field is a npm one https://docs.npmjs.com/misc/scripts

It is executed when using npm install command.
NWJS does not use it.

So the answer is no

@Bryan-Turek
Copy link

Although, you could run your own command through nodejs.

https://nodejs.org/api/child_process.html#child_process_child_process_exec_command_options_callback

This solution wouldn't be cross-platform however.

@baconbrad
Copy link

Look into an NPM that already does this. Here are two. Hopefully one does what you are looking for. Fire it off in one of your scripts or put it in your node-main script.

node-python

python-shell

@Christywl
Copy link
Contributor

Please ask questions in our mailing list: https://groups.google.com/forum/#!forum/nwjs-general

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants