1

I'd like to run text processing Python scripts after submitting searchForms of my node.js application.

I know how the scripts can be called with child_process and spawn within js, but what should I set up on the app (probably some package.json entries?) so that it will be able to run Python after deploying to Bluemix?

Thanks for any help!

2 Answers 2

1

I finally fixed this as adding an entry to dependencies in package.json of the project, which causes the call of npm install for the linked github repo. It is kinda straightforward but I found no explanation for that on Bluemix resources.

Sign up to request clarification or add additional context in comments.

Comments

0

There is a helpful library called python-shell you can use. Here is a basic example of its usage:

var PythonShell = require('python-shell');

PythonShell.run('my_script.py', function (err) {
  if (err) throw err;
  console.log('finished');
});

There are 100 other ways to do this, but this is likely the easiest.

Hope this helps

4 Comments

I think the problem is that Python is not installed when you deploy your Node.js application to Bluemix.
That assumes information not given in the original question. That is very possible, but not stated in the question.
Yes, the main problem is what was mentioned by @Alex da Silva, sorry for not explaining it clearly in the question. I know for instance the 'python-shell' have to be added to package.json inorder to get Bluemix to install it, but I don't know the correct way. Do you have any ideas?
Okay - I see what you mean. Yes, a Python run time will need to be spun up as a runtime on Bluemix, or a virtual machine with both Node.js and Python installed to run Py scripts alongside a Node.js app

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.