从Node.js Express校准Python函数时出错

时间:2018-11-05 04:11:26

标签: javascript python node.js express node-modules

尝试搜索表单,但找不到解决方案,非常感谢您提供任何帮助。

尝试从node express调用Python,但遇到错误。

var PythonShell = require('python-shell')

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

OR

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

错误

function extend(obj, ...args) {
                     ^^^

SyntaxError: Unexpected token ...
    at exports.runInThisContext (vm.js:53:16)
    at Module._compile (module.js:414:25)
    at Object.Module._extensions..js (module.js:442:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:311:12)
    at Module.require (module.js:366:17)
    at require (module.js:385:17)
    at Object.<anonymous> (P:\html\testPy.js:1:81)
    at Module._compile (module.js:435:26)
    at Object.Module._extensions..js (module.js:442:10)

0 个答案:

没有答案