Запустите скрипт python, используя узел js error no 22 - PullRequest
0 голосов
/ 04 мая 2018

Я использую node.js для запуска скрипта Python через веб-браузер. ниже приведен код ScriptRunner.js.

var PythonShell = require('python-shell');
var path = require('path');
exports.runScript = function() {
   var options = {
       scriptPath: 'D:\L4Project\working code\finalproject\routes'
   };
PythonShell.run('sensitive2.py',options, function (err, results) {
  if (err) throw err;

  console.log('results: %j', results);
});
}

когда я запускаю скрипт в браузере, он возвращает сообщение об ошибке, как показано ниже.

D:\L4Project\working code\finalproject\routes\scriptRunner.js:10
      if (err) throw err;
               ^

outes\sensitive2.py': [Errno 22] Invalid argumentg codeinalproject at PythonShell.parseError (D:\L4Project\working code\finalproject\node_modules\python-shell\index.js:191:17)
    at terminateIfNeeded (D:\L4Project\working code\finalproject\node_modules\python-shell\index.js:98:28)
    at ChildProcess.<anonymous> (D:\L4Project\working code\finalproject\node_modules\python-shell\index.js:89:9)
    at emitTwo (events.js:126:13)
    at ChildProcess.emit (events.js:214:7)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)

У меня много гуглов и ничего не работает. Кто-нибудь может помочь мне решить проблему?

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...