简体   繁体   English

从node.js执行python脚本

[英]executing python script from a node.js

I am trying to run a python a script which will update my elasticsearch data base, from a server which is implemented in node.js. 我正在尝试运行一个python脚本,它将从node.js中实现的服务器更新我的elasticsearch数据库。 My python script requires a csv files to read. 我的python脚本需要一个csv文件来读取。 though the csv file is present it is giving me this error(shown in image 虽然csv文件存在,但它给了我这个错误(如图所示) 错误 )

I think you will need to specify the filepaths relative to where your Node script is running from, rather than the Python one. 我认为您需要指定相对于运行Node脚本的文件路径,而不是Python脚本。

So if you have file structure: 所以如果你有文件结构:

- app.js
- /PythonFolder
   - script.py
   - data.csv

You will need to call the Python using whatever the equivalent to: 您将需要使用等效于以下内容的任何方式调用Python:

python script.py PythonFolder/data.csv 

is from Node . 来自Node

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM