如何将大量数据从 node.js 应用程序发送到 python 文件?

问题描述

我有一个包含 2 个(或更多)嵌套对象的 json 对象,每个对象中有 18 个键值对,基本上 json 对象是一个存储文章的对象,每个嵌套对象都包含此类信息。

>
{
createdAt: date,lastUpdated: date,content: of 250 words,...
.
.
.
.
.
.

and many more fields
}

现在我想将此对象发送到某个机器学习应用程序的 python 文件,并且我已经使用 spawn 模块完成了它,我通过以下命令发送此数据:

const childPython = spawn('python',['hello.py',JSON.stringify(posts)])

但它显示了这个错误

(node:21728) UnhandledPromiseRejectionWarning: Error: spawn ENAMetoOLONG
    at ChildProcess.spawn (internal/child_process.js:403:11)
    at spawn (child_process.js:553:9)
    at Object.showObj.getSimilararticles (D:\done\VSCode\learners backend v2\controllers\showPageController.js:92:27)
    at processticksAndRejections (internal/process/task_queues.js:93:5)
    at async D:\done\VSCode\learners backend v2\routes\posts.js:1519:3
(Use `node --trace-warnings ...` to show where the warning was created)
(node:21728) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block,or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection,use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:21728) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future,promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

现在我的问题是因为尺寸大,如果是的话,还有其他可能的解决方案来传达数据吗? 如果不是,我做错了什么,我该如何纠正?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)