node.js - 如何将大量数据从 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.
现在我的问题是,是不是因为尺寸大,如果是,还有其他解决方案可以传达数据吗?如果没有,我做错了什么,我该如何纠正?
解决方案
推荐阅读
- shell - Cat 直到 bash 中出现某些 nb
- python - 卷积层中的内积(矩阵乘法)
- c++ - Atmel Studio 7 设置 int = 0,返回 257
- java - 如何在等距 libgdx 中触摸它时获得平铺位置
- python - Sypder 的多个控制台比多处理更快?
- netsuite - 等待支持回复字段在 NetSuite 中的具体工作原理是什么?
- angular - 无法在以前隐藏的 cdkDropList 中删除元素
- python - Python selenium 下载带有 headless 和 plugins.always_open_pdf_externally 的 pdf
- java - 有什么方法可以预览 Intellij 为 java 运行配置生成的命令行?
- asp.net - 在 .NET core 2.0 中显示 json 数据的问题