python执行shell命令 没有错 nodejs_在Nodejs中使用PythonShell模块

我一直在试图遵循npm pythonshellhere的文档。我只是想得到一个简单的例子来正确地工作,但没有成功,网上没有很多例子,但我确实试着遵循这个one on stackoverflow。那么我的代码到底怎么了?我不太清楚为什么我会犯下面的错误。我对python更熟悉,nodejs对我来说是一个新领域。谢谢你的帮助。

test.py代码:print("This is a test")

使用pythonsell测试的Nodejs:var PythonShell = require('python-shell');

var options = {

mode: 'text',

pythonPath: '/bin/bash/python2',

pythonOptions: ['-u'],

scriptPath: './TestProject/',

args: ['value1', 'value2', 'value3']

};

PythonShell.run('test.py', options, function (err, results) {

if (err) throw err;

// results is an array consisting of messages collected during execution

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

});

这是我的错误internal/child_process.js:313

throw errnoException(err, 'spawn');

^

Error: spawn ENOTDIR

at exports._errnoException (util.js:1022:11)

at ChildProcess.spawn (internal/child_process.js:313:11)

at exports.spawn (child_process.js:387:9)

at new PythonShell (/home/nomad/TestProject/node_modules/python-shell/index.js:59:25)

at Function.PythonShell.run (/home/nomad/TestProject/node_modules/python-shell/index.js:159:19)

at Object. (/home/nomad/TestProject/app.js:11:13)

at Module._compile (module.js:571:32)

at Object.Module._extensions..js (module.js:580:10)

at Module.load (module.js:488:32)

at tryModuleLoad (module.js:447:12)

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值