I have installed Python on my PC (Windows 7) in order to implement tests for a Node application using casperjs. I want to be able to launch a casperjs from Node.
I have implemented a spawn child in Node:
var spawn = require('child_process').spawn;
var bin = "casper.cmd";
var args = [''];
var cspr = spawn(bin, args, {stdio: 'inherit'});
cspr.on('exit', function (code) {
console.log('child process exited with code ' + code);
process.exit(code);
});
In the same directory, I have implement the casper.cmd
file:
casperjs casper_test.js
My casper test is the following:
var casper = require('casper').create();
casper.start('http://google.com/', function() {
this.echo(this.getTitle(), 'INFO');
});
casper.run();
When I launch the first file with Node, I get:
C:\... ...\_test>casperjs casper_test.js
'python' is not recognized as an internal or external command,
operable program or batch file.
child process exited with code 1
When I open a command line window and type python, it works. Hence, it means the PATH environment variable has been set properly.
How can I solve this issue?